Mesh: Replace auto smooth with node group #108014

Merged
Hans Goudey merged 149 commits from HooglyBoogly/blender:refactor-mesh-corner-normals-lazy into main 2023-10-20 16:54:20 +02:00
3 changed files with 19 additions and 1 deletions
Showing only changes of commit 1f204b4b84 - Show all commits

View File

@ -602,6 +602,11 @@ struct Mesh *ED_mesh_context(struct bContext *C);
*/
void ED_mesh_split_faces(struct Mesh *mesh);
/**
* Reset and fill the "sharp_edge" attribute based on the angle of manifold edges.
*/
void ED_mesh_sharp_from_angle_set(struct Mesh *mesh, float angle);
/* mesh backup */
typedef struct BMBackup {
struct BMesh *bmcopy;

View File

@ -1447,3 +1447,11 @@ void ED_mesh_split_faces(Mesh *mesh)
geometry::split_edges(*mesh, split_mask, {});
}
void ED_mesh_sharp_from_angle_set(Mesh *mesh, const float angle)
{
mesh->attributes_for_write().remove("sharp_edge");
mesh->attributes_for_write().remove("sharp_face");
BKE_mesh_sharp_edges_set_from_angle(mesh, angle);
DEG_id_tag_update(&mesh->id, ID_RECALC_GEOMETRY);
}

View File

@ -12,8 +12,8 @@
#include "DNA_customdata_types.h"
#include "BLI_math_base.h"
#include "BLI_sys_types.h"
#include "BLI_utildefines.h"
#include "rna_internal.h" /* own include */
@ -215,6 +215,11 @@ void RNA_api_mesh(StructRNA *srna)
RNA_def_function_ui_description(
func, "Deprecated. Has no effect. Normals are calculated upon retrieval");
func = RNA_def_function(srna, "set_sharp_from_angle", "ED_mesh_sharp_from_angle_set");
RNA_def_function_ui_description(
func, "Set the sharp edge status for edges based on the angle of incident faces");
RNA_def_float(func, "angle", M_PI, 0.0f, M_PI, "Angle", "", 0.0f, M_PI);
func = RNA_def_function(srna, "split_faces", "rna_Mesh_split_faces");
RNA_def_function_ui_description(func, "Split faces based on the edge angle");
/* TODO: This parameter has no effect anymore, since the internal code does not need to