diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-04-25 22:03:16 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-04-25 22:07:55 +0300 |
commit | 185d9627b3156d30596e19f611941c1ed0e88e5b (patch) | |
tree | afc7da80a35977b08eb75c7d2501e3d9c1cb7aca /source | |
parent | f431be224fa58374386a32dba2542ee20d2a2d61 (diff) |
Fix T97423: Make mask filter less confusing
by showing redo panel.
The A hotkey has "auto iteration" enabled by default,
which calculates the number of times to run the filter
using a heuristic based on vertex count.
To make clear to the user what is going on the redo
panel is now shown for the mask filter operator.
NOTE: I discovered the source of the bug where sculpt
operators' redo panels were greyed out. The name
fed to SCULPT_undo_push_begin must match the operator
name. I've added a comment in sculpt_intern explaining
this.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_filter_mask.c | 9 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_intern.h | 5 | ||||
m--------- | source/tools | 0 |
3 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mask.c b/source/blender/editors/sculpt_paint/sculpt_filter_mask.c index c8137301de5..172c1f44e47 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mask.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mask.c @@ -176,9 +176,7 @@ static void mask_filter_task_cb(void *__restrict userdata, static int sculpt_mask_filter_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); - SculptSession *ss = ob->sculpt; Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); - PBVH *pbvh = ob->sculpt->pbvh; PBVHNode **nodes; Sculpt *sd = CTX_data_tool_settings(C)->sculpt; int totnode; @@ -186,6 +184,9 @@ static int sculpt_mask_filter_exec(bContext *C, wmOperator *op) BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); + SculptSession *ss = ob->sculpt; + PBVH *pbvh = ob->sculpt->pbvh; + SCULPT_vertex_random_access_ensure(ss); if (!ob->sculpt->pmap) { @@ -195,7 +196,7 @@ static int sculpt_mask_filter_exec(bContext *C, wmOperator *op) int num_verts = SCULPT_vertex_count_get(ss); BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); - SCULPT_undo_push_begin(ob, "Mask filter"); + SCULPT_undo_push_begin(ob, "Mask Filter"); for (int i = 0; i < totnode; i++) { SCULPT_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK); @@ -274,7 +275,7 @@ void SCULPT_OT_mask_filter(struct wmOperatorType *ot) ot->exec = sculpt_mask_filter_exec; ot->poll = SCULPT_mode_poll; - ot->flag = OPTYPE_REGISTER; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* RNA. */ RNA_def_enum(ot->srna, diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index f13f1c79a7a..f9633c91087 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -1448,6 +1448,11 @@ void SCULPT_cache_free(StrokeCache *cache); SculptUndoNode *SCULPT_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType type); SculptUndoNode *SCULPT_undo_get_node(PBVHNode *node); SculptUndoNode *SCULPT_undo_get_first_node(void); + +/** + * NOTE: `name` must match operator name for + * redo panels to work. + */ void SCULPT_undo_push_begin(struct Object *ob, const char *name); void SCULPT_undo_push_end(struct Object *ob); void SCULPT_undo_push_end_ex(struct Object *ob, const bool use_nested_undo); diff --git a/source/tools b/source/tools -Subproject 1e658ca996f11e5ff3398d89bd81f5b719304a5 +Subproject 50c27746f2a7c86ab4a0cfa8899b292af5dd07b |