diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-04-16 04:49:38 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-04-16 04:49:38 +0300 |
commit | 2b191cd2b41b7eaa794ef8d7f702482ab3d1b6eb (patch) | |
tree | 0ecd5cbfb333b47a114136906493cd4a8c19e526 /source/blender/editors | |
parent | 8eb40d2063149b03db6665993856f08201eadd04 (diff) |
Mask by color now auto-creates a
color attribute if one does not exist,
and no longer passes through to the
translate tool on tweak grab.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_ops.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c index f84852d1d0e..9581bf2071c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_ops.c +++ b/source/blender/editors/sculpt_paint/sculpt_ops.c @@ -1030,14 +1030,6 @@ static int sculpt_mask_by_color_invoke(bContext *C, wmOperator *op, const wmEven return OPERATOR_CANCELLED; } - if (!SCULPT_has_colors(ss)) { - return OPERATOR_CANCELLED; - } - - if (SCULPT_has_loop_colors(ob)) { - BKE_pbvh_ensure_node_loops(ss->pbvh); - } - SCULPT_vertex_random_access_ensure(ss); /* Tools that are not brushes do not have the brush gizmo to update the vertex as the mouse move, @@ -1049,12 +1041,17 @@ static int sculpt_mask_by_color_invoke(bContext *C, wmOperator *op, const wmEven SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false); SCULPT_undo_push_begin(ob, "Mask by color"); + BKE_sculpt_color_layer_create_if_needed(ob); const int active_vertex = SCULPT_active_vertex_get(ss); const float threshold = RNA_float_get(op->ptr, "threshold"); const bool invert = RNA_boolean_get(op->ptr, "invert"); const bool preserve_mask = RNA_boolean_get(op->ptr, "preserve_previous_mask"); + if (SCULPT_has_loop_colors(ob)) { + BKE_pbvh_ensure_node_loops(ss->pbvh); + } + if (RNA_boolean_get(op->ptr, "contiguous")) { sculpt_mask_by_color_contiguous(ob, active_vertex, threshold, invert, preserve_mask); } @@ -1080,7 +1077,7 @@ static void SCULPT_OT_mask_by_color(wmOperatorType *ot) /* api callbacks */ ot->invoke = sculpt_mask_by_color_invoke; - ot->poll = SCULPT_vertex_colors_poll; + ot->poll = SCULPT_mode_poll; ot->flag = OPTYPE_REGISTER; |