diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2020-01-28 20:33:41 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2020-01-28 20:34:55 +0300 |
commit | b7075049732a0df53be6483ab5fc2333398b9ebb (patch) | |
tree | 65f1ed8e413fbcddec85d82bc456956228c2f0de /source/blender/editors/screen/screen_ops.c | |
parent | 49403a676b81b0d6ca3d13c277af6de312153d3b (diff) |
UI: Edit Menu - Undo History List and Operator Polling
Enable and Disable Edit Menu items based on whether those actions are currently applicable.
https://developer.blender.org/D4846
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 0e1ae03fd20..14ea3aca623 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3643,6 +3643,15 @@ static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot) /** \name Repeat Last Operator * \{ */ +static bool repeat_history_poll(bContext *C) +{ + if (!ED_operator_screenactive(C)) { + return false; + } + wmWindowManager *wm = CTX_wm_manager(C); + return !BLI_listbase_is_empty(&wm->operators); +} + static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op)) { wmWindowManager *wm = CTX_wm_manager(C); @@ -3676,7 +3685,7 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot) /* api callbacks */ ot->exec = repeat_last_exec; - ot->poll = ED_operator_screenactive; + ot->poll = repeat_history_poll; } /** \} */ @@ -3743,8 +3752,7 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot) /* api callbacks */ ot->invoke = repeat_history_invoke; ot->exec = repeat_history_exec; - - ot->poll = ED_operator_screenactive; + ot->poll = repeat_history_poll; RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000); } @@ -3775,8 +3783,7 @@ static void SCREEN_OT_redo_last(wmOperatorType *ot) /* api callbacks */ ot->invoke = redo_last_invoke; - - ot->poll = ED_operator_screenactive; + ot->poll = repeat_history_poll; } /** \} */ |