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 | |
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')
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_ops.c | 15 |
2 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index c0195e5abc8..5fd7984ea90 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1869,6 +1869,10 @@ void BKE_sculpt_color_layer_create_if_needed(struct Object *object) BKE_id_attributes_active_color_set(&orig_me->id, layer); DEG_id_tag_update(&orig_me->id, ID_RECALC_GEOMETRY_ALL_MODES); + + if (object->sculpt && object->sculpt->pbvh) { + BKE_pbvh_update_active_vcol(object->sculpt->pbvh, orig_me); + } } void BKE_sculpt_update_object_for_edit( 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; |