diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 12 |
3 files changed, 19 insertions, 4 deletions
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 06185a583bb..cf8dbdd8c63 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -398,13 +398,15 @@ enum { /* low level flag so exec() operators can tell if they were invoked, use with care. * typically this shouldn't make any difference, but it rare cases its needed (see smooth-view) */ OP_IS_INVOKE = (1 << 0), + /* So we can detect if an operators exec() call is activated from an interactive repeat. */ + OP_IS_REPEAT = (1 << 1), /* When the cursor is grabbed */ - OP_IS_MODAL_GRAB_CURSOR = (1 << 1), + OP_IS_MODAL_GRAB_CURSOR = (1 << 2), /* allow modal operators to have the region under the cursor for their context * (the regiontype is maintained to prevent errors) */ - OP_IS_MODAL_CURSOR_REGION = (1 << 2), + OP_IS_MODAL_CURSOR_REGION = (1 << 3), }; #endif /* __DNA_WINDOWMANAGER_TYPES_H__ */ diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 5b4fe30aaef..265758eb5c3 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1443,6 +1443,11 @@ static void rna_def_operator_options_runtime(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Invoke", "True when invoked (even if only the execute callbacks available)"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "is_repeat", PROP_BOOLEAN, PROP_BOOLEAN); + RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_REPEAT); + RNA_def_property_ui_text(prop, "Repeat", "True when run from the redo panel"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "use_cursor_region", PROP_BOOLEAN, PROP_BOOLEAN); RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_CURSOR_REGION); RNA_def_property_ui_text(prop, "Focus Region", "Enable to use the region under the cursor for modal execution"); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index ed56586711d..61c144a63d4 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -802,14 +802,22 @@ static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, cons return retval; if (op->type->exec) { - if (op->type->flag & OPTYPE_UNDO) + if (op->type->flag & OPTYPE_UNDO) { wm->op_undo_depth++; + } + if (repeat) { + op->flag |= OP_IS_REPEAT; + } retval = op->type->exec(C, op); OPERATOR_RETVAL_CHECK(retval); + if (repeat) { + op->flag &= ~OP_IS_REPEAT; + } - if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) + if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) { wm->op_undo_depth--; + } } /* XXX Disabled the repeat check to address part 2 of #31840. |