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.
This commit is contained in:
Joseph Eagar 2022-04-25 12:03:16 -07:00
parent f431be224f
commit 185d9627b3
Notes: blender-bot 2023-02-14 04:56:36 +01:00
Referenced by issue #97423, Sculpt mode. Grow mask jumps to lot of steps at once
5 changed files with 13 additions and 7 deletions

@ -1 +1 @@
Subproject commit 716dc02ec30c0810513f7b4adc4ae865ae50c4e6
Subproject commit 2e715d54178e24ea463c7bc0cdeb27c682c39ecf

@ -1 +1 @@
Subproject commit 787ea78f7fa6f0373d80ba1247768402df93f8ad
Subproject commit d1b824f3c2a7a7b3e37e70f336e5a1580028c63e

View File

@ -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,

View File

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

@ -1 +1 @@
Subproject commit 1e658ca996f11e5ff3398d89bd81f5b719304a57
Subproject commit 50c27746f2a7c86ab4a0cfa8899b292af5dd07b6