diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-03-12 19:22:21 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-03-12 19:22:21 +0300 |
commit | d6940e4e896457bab83aceb7588342054ad0892b (patch) | |
tree | 761898bb97e5ac183e17b4c8bb091a0a24e16582 /source/blender/makesrna/intern | |
parent | ec58cbbfa6ea7170087736f69389d71ad9e19c1a (diff) |
Heavy refactor of weighted normals code, especially 'keep sharp' part.
Before, 'keep sharp' was bsically:
* Overwriting everything just computed by 'single nor per vertex' code,
leading to a nice share of computations being tossed to nowhere.
* Re-implementing most of core clnor computaion code, only skipping all
'sharp edge' cases but the one defined by shapr edge tags. This was not
only bad for code maintenance and (reasonable) simplicity, it was also
introducing inconsistencies in how we define sharp edges, since
everwhere else in code we take into account sharp edge tag, flat face
tag, and 'smooth threshold' value (aka split angle) of mesh.
At first I though 'keep sharp' would need its own totally separated code
path, but thanks to some data structure tricks, it was possible to merge
most of both cases into single code. So this commit:
* Heavily factorizes and simplifies code, especially the 'keep sharp' case.
* Makes use of clnor spaces as generated by core BKE code to define
'smooth fans' that should have the same weighted normals, just like
anywhere else in Blender.
Note that since code is now using same functions in all cases, it also
naturally brings back vgroup support in keep_sharp case.
Also, this has been a fairly involved change, basic testing seems to be
OK, but more would be welcomed here. :)
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 0cc5a33f0ca..35d44a97566 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -4821,8 +4821,8 @@ static void rna_def_modifier_weightednormal(BlenderRNA *brna) static EnumPropertyItem prop_weighting_mode_items[] = { {MOD_WEIGHTEDNORMAL_MODE_FACE, "FACE_AREA", 0, "Face Area", "Generate face area weighted normals"}, {MOD_WEIGHTEDNORMAL_MODE_ANGLE, "CORNER_ANGLE", 0, "Corner Angle", "Generate corner angle weighted normals"}, - {MOD_WEIGHTEDNORMAL_MODE_FACE_ANGLE, "FACE_AREA_WITH_ANGLE", 0, "Face Area with Angle", - "Generated normals weighted by both Face Area and Angle"}, + {MOD_WEIGHTEDNORMAL_MODE_FACE_ANGLE, "FACE_AREA_WITH_ANGLE", 0, "Face Area And Angle", + "Generated normals weighted by both face area and angle"}, {0, NULL, 0, NULL, NULL} }; @@ -4834,7 +4834,10 @@ static void rna_def_modifier_weightednormal(BlenderRNA *brna) prop = RNA_def_property(srna, "weight", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 1, 100); RNA_def_property_ui_range(prop, 1, 100, 1, -1); - RNA_def_property_ui_text(prop, "Weight", "Weights given to Face Normal for each mode"); + RNA_def_property_ui_text(prop, "Weight", + "Corrective factor applied to faces' weights, 50 is neutral, " + "lower values increase weight of weak faces, " + "higher values increase weight of strong faces"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); @@ -4850,7 +4853,9 @@ static void rna_def_modifier_weightednormal(BlenderRNA *brna) prop = RNA_def_property(srna, "keep_sharp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WEIGHTEDNORMAL_KEEP_SHARP); - RNA_def_property_ui_text(prop, "Keep Sharp Edges", "Do not edit normals of sharp edges"); + RNA_def_property_ui_text(prop, "Keep Sharp", + "Keep sharp edges as computed for default split normals, " + "instead of setting a single weighted normal for each vertex."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); |