[Bf-blender-cvs] [69529177be1] master: Revert "Fix T60126: Gradient affects hidden vertices when weight painting"

Campbell Barton noreply at git.blender.org
Tue Jan 22 22:47:14 CET 2019


Commit: 69529177be11be25b5a929c658af66612101d87b
Author: Campbell Barton
Date:   Wed Jan 23 08:24:54 2019 +1100
Branches: master
https://developer.blender.org/rB69529177be11be25b5a929c658af66612101d87b

Revert "Fix T60126: Gradient affects hidden vertices when weight painting"

This reverts commit 06a6b5dba459d4153d85c5894e3c3e72abeb34e3.

The error is that geometry was hidden in the first place,
this should only apply when selecting verts/faces.

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

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

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

diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index e94e8a2eee2..7100bf33a47 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -625,13 +625,13 @@ static void gradientVertUpdate__mapFunc(
         const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
 {
 	WPGradient_userData *grad_data = userData;
-	WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
-
-	if (vs->sco[0] == FLT_MAX) {
-		return;
+	Mesh *me = grad_data->me;
+	if ((grad_data->use_select == false) || (me->mvert[index].flag & SELECT)) {
+		WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
+		if (vs->sco[0] != FLT_MAX) {
+			gradientVert_update(grad_data, index);
+		}
 	}
-
-	gradientVert_update(grad_data, index);
 }
 
 static void gradientVertInit__mapFunc(
@@ -640,46 +640,42 @@ static void gradientVertInit__mapFunc(
 {
 	WPGradient_userData *grad_data = userData;
 	Mesh *me = grad_data->me;
-	WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
 
-	if (grad_data->use_select && !(me->mvert[index].flag & SELECT)) {
-		copy_v2_fl(vs->sco, FLT_MAX);
-		return;
-	}
-
-	if (me->mvert[index].flag & ME_HIDE) {
-		copy_v2_fl(vs->sco, FLT_MAX);
-		return;
-	}
-
-	/* run first pass only,
-	 * the screen coords of the verts need to be cached because
-	 * updating the mesh may move them about (entering feedback loop) */
-	if (BLI_BITMAP_TEST(grad_data->vert_visit, index)) {
-		copy_v2_fl(vs->sco, FLT_MAX);
-		return;
-	}
+	if ((grad_data->use_select == false) || (me->mvert[index].flag & SELECT)) {
+		/* run first pass only,
+		 * the screen coords of the verts need to be cached because
+		 * updating the mesh may move them about (entering feedback loop) */
+
+		if (BLI_BITMAP_TEST(grad_data->vert_visit, index) == 0) {
+			WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
+			if (ED_view3d_project_float_object(
+			            grad_data->ar,
+			            co, vs->sco,
+			            V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
+			{
+				/* ok */
+				MDeformVert *dv = &me->dvert[index];
+				const MDeformWeight *dw;
+				dw = defvert_find_index(dv, grad_data->def_nr);
+				if (dw) {
+					vs->weight_orig = dw->weight;
+					vs->flag = VGRAD_STORE_DW_EXIST;
+				}
+				else {
+					vs->weight_orig = 0.0f;
+					vs->flag = VGRAD_STORE_NOP;
+				}
 
-	if (ED_view3d_project_float_object(
-	            grad_data->ar,
-	            co, vs->sco,
-	            V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) != V3D_PROJ_RET_OK)
-	{
-		return;
-	}
+				BLI_BITMAP_ENABLE(grad_data->vert_visit, index);
 
-	MDeformVert *dv = &me->dvert[index];
-	const MDeformWeight *dw = defvert_find_index(dv, grad_data->def_nr);
-	if (dw) {
-		vs->weight_orig = dw->weight;
-		vs->flag = VGRAD_STORE_DW_EXIST;
-	}
-	else {
-		vs->weight_orig = 0.0f;
-		vs->flag = VGRAD_STORE_NOP;
+				gradientVert_update(grad_data, index);
+			}
+			else {
+				/* no go */
+				copy_v2_fl(vs->sco, FLT_MAX);
+			}
+		}
 	}
-	BLI_BITMAP_ENABLE(grad_data->vert_visit, index);
-	gradientVert_update(grad_data, index);
 }
 
 static int paint_weight_gradient_modal(bContext *C, wmOperator *op, const wmEvent *event)



More information about the Bf-blender-cvs mailing list