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
This commit is contained in:
parent
2a24b3aaf4
commit
aa4cf47e40
Notes:
blender-bot
2023-02-14 11:20:29 +01:00
Referenced by issue #80273, Restrict option in weight paint doesn't work with gradient
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue