[Bf-blender-cvs] [10ac7c0] master: Fix weight paint normalizing w/ locked groups

Campbell Barton noreply at git.blender.org
Thu Jan 14 04:15:17 CET 2016


Commit: 10ac7c0f15cbf82ee4dca2e10fd2a313f896d8e6
Author: Campbell Barton
Date:   Thu Jan 14 14:05:15 2016 +1100
Branches: master
https://developer.blender.org/rB10ac7c0f15cbf82ee4dca2e10fd2a313f896d8e6

Fix weight paint normalizing w/ locked groups

Reported as part of T47123

Checks for locked groups assumed auto-normalize
and would distribute wight between groups even with auto-normalize disabled.

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

M	source/blender/editors/sculpt_paint/paint_vertex.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index d632138..76326f4 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1700,8 +1700,6 @@ static void do_weight_paint_vertex(
 	MDeformVert *dv_mirr;
 	MDeformWeight *dw_mirr;
 
-	const short do_multipaint_totsel = (wpi->do_multipaint && wpi->defbase_tot_sel > 1);
-
 	if (wp->flag & VP_ONLYVGROUP) {
 		dw = defvert_find_index(dv, wpi->vgroup_active);
 		dw_prev = defvert_find_index(wp->wpaint_prev + index, wpi->vgroup_active);
@@ -1765,15 +1763,15 @@ static void do_weight_paint_vertex(
 		dw_mirr = NULL;
 	}
 
-
-	/* TODO: De-duplicate the simple weight paint - jason */
-	/* ... or not, since its <10 SLOC - campbell */
-
-	/* If there are no locks or multipaint,
+	/* If there are no normalize-locks or multipaint,
 	 * then there is no need to run the more complicated checks */
-	if ((do_multipaint_totsel == false) &&
-	    (wpi->lock_flags == NULL || has_locked_group(dv, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags) == false))
-	{
+	const bool do_multipaint_totsel =
+	        (wpi->do_multipaint && wpi->defbase_tot_sel > 1);
+	const bool do_locked_normalize  =
+	        (wpi->do_auto_normalize && wpi->lock_flags &&
+	         has_locked_group(dv, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags));
+
+	if ((do_multipaint_totsel || do_locked_normalize) == false) {
 		dw->weight = wpaint_blend(wp, dw->weight, dw_prev->weight, alpha, paintweight,
 		                          wpi->brush_alpha_value, wpi->do_flip, false);




More information about the Bf-blender-cvs mailing list