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);