diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-08-31 17:00:24 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-09-04 11:30:06 +0300 |
commit | aa4cf47e403ba3f098d89e991dafc9fec30423c4 (patch) | |
tree | 95e056870ec1229cac8653f6b2b66b0d1cef3cf7 | |
parent | 2a24b3aaf4c846a5d98f783fef69946584865df9 (diff) |
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
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c | 9 |
1 files changed, 8 insertions, 1 deletions
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); |