[Bf-blender-cvs] [e294a1154c4] soc-2017-normal-tools: Change 'face strength' values.

Bastien Montagne noreply at git.blender.org
Fri Mar 9 18:50:48 CET 2018


Commit: e294a1154c489d72157333349074394c86bae832
Author: Bastien Montagne
Date:   Fri Mar 9 18:40:09 2018 +0100
Branches: soc-2017-normal-tools
https://developer.blender.org/rBe294a1154c489d72157333349074394c86bae832

Change 'face strength' values.

WARNING! this will break files saved with this branch and using face
strength feature (no crash or data corruption, but face strength values
will become invalid and will produce weird results)!

Rationals for this change are:
* Having strength values in natural order simplifies existing code
already, not to mention any future potential addition to strengthes.
* Now, code will work as-is, even if we decide to add more stength
values in the future.

===================================================================

M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/modifiers/intern/MOD_weighted_normal.c

===================================================================

diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 6ebc06a6c33..7620f72041e 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -2035,9 +2035,9 @@ enum {
 
 /* toolsettings->face_strength */
 enum {
-	FACE_STRENGTH_WEAK = 1,
+	FACE_STRENGTH_WEAK = -16384,
 	FACE_STRENGTH_MEDIUM = 0,
-	FACE_STRENGTH_STRONG = 2,
+	FACE_STRENGTH_STRONG = 16384,
 };
 
 /* object_vgroup.c */
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c
index 56367f869d6..ef1c7b170c6 100644
--- a/source/blender/modifiers/intern/MOD_weighted_normal.c
+++ b/source/blender/modifiers/intern/MOD_weighted_normal.c
@@ -134,9 +134,7 @@ static bool check_strength(WeightedNormalData *wn_data, const int mv_index, cons
 	int *vert_loops_count = wn_data->vert_loops_count;
 	float (*vert_normals)[3] = wn_data->vert_normals;
 
-	if ((mp_strength == FACE_STRENGTH_STRONG && curr_vert_strength[mv_index] != FACE_STRENGTH_STRONG) ||
-	    (mp_strength == FACE_STRENGTH_MEDIUM && curr_vert_strength[mv_index] == FACE_STRENGTH_WEAK))
-	{
+	if (mp_strength > curr_vert_strength[mv_index]) {
 		curr_vert_strength[mv_index] = mp_strength;
 		curr_vert_val[mv_index] = 0.0f;
 		vert_loops_count[mv_index] = 0;



More information about the Bf-blender-cvs mailing list