[Bf-blender-cvs] [aa4cf47e403] master: Fix T80273: Restrict option in weight paint doesn't work with gradient

Philipp Oeser noreply at git.blender.org
Fri Sep 4 10:38:51 CEST 2020


Commit: aa4cf47e403ba3f098d89e991dafc9fec30423c4
Author: Philipp Oeser
Date:   Mon Aug 31 16:00:24 2020 +0200
Branches: master
https://developer.blender.org/rBaa4cf47e403ba3f098d89e991dafc9fec30423c4

Fix T80273: Restrict option in weight paint doesn't work with gradient

With the 'Restrict' option, the gradient should be restricted to the
assigned vertex, just like the other weight paint tools.

Maniphest Tasks: T80273

Differential Revision: https://developer.blender.org/D8761

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

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 73014f9f2de..9b8252e1add 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -594,6 +594,7 @@ typedef struct WPGradient_userData {
 
   /* options */
   bool use_select;
+  bool use_vgroup_restrict;
   short type;
   float weightpaint;
 } WPGradient_userData;
@@ -602,8 +603,13 @@ static void gradientVert_update(WPGradient_userData *grad_data, int index)
 {
   Mesh *me = grad_data->me;
   WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
-  float alpha;
 
+  /* Optionally restrict to assigned verices only. */
+  if (grad_data->use_vgroup_restrict && ((vs->flag & VGRAD_STORE_DW_EXIST) == 0)) {
+    return;
+  }
+
+  float alpha;
   if (grad_data->type == WPAINT_GRADIENT_TYPE_LINEAR) {
     alpha = line_point_factor_v2(vs->sco, grad_data->sco_start, grad_data->sco_end);
   }
@@ -815,6 +821,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
 
     data.brush = brush;
     data.weightpaint = BKE_brush_weight_get(scene, brush);
+    data.use_vgroup_restrict = (ts->wpaint->flag & VP_FLAG_VGROUP_RESTRICT) != 0;
   }
 
   ED_view3d_init_mats_rv3d(ob, region->regiondata);



More information about the Bf-blender-cvs mailing list