diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2019-05-19 23:12:15 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2019-05-19 23:12:15 +0300 |
commit | b7eba20236ca6499a62a8ee2b0c852086bc46b8e (patch) | |
tree | c279de38a9f6318b5e15d3ba53d79b0b92cbffb6 /source/blender/editors/screen | |
parent | ec02bc299e3371afad02a9ffd7dc0278998b0659 (diff) |
UI: Edit Menu Operator Polling
This patch updates the polling that enable/disables Edit Menu items. Slight Undo History menu changes
Differential Revision: https://developer.blender.org/D4846
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index af90bbc9975..a94c0e35876 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3564,6 +3564,12 @@ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; } +static bool repeat_last_poll(bContext *C) +{ + wmWindowManager *wm = CTX_wm_manager(C); + return ED_operator_screenactive(C) && !BLI_listbase_is_empty(&wm->operators); +} + static void SCREEN_OT_repeat_last(wmOperatorType *ot) { /* identifiers */ @@ -3574,7 +3580,7 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot) /* api callbacks */ ot->exec = repeat_last_exec; - ot->poll = ED_operator_screenactive; + ot->poll = repeat_last_poll; } /** \} */ @@ -3627,6 +3633,12 @@ static int repeat_history_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static bool repeat_history_poll(bContext *C) +{ + wmWindowManager *wm = CTX_wm_manager(C); + return ED_operator_screenactive(C) && !BLI_listbase_is_empty(&wm->operators); +} + static void SCREEN_OT_repeat_history(wmOperatorType *ot) { /* identifiers */ @@ -3638,7 +3650,7 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot) 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); } @@ -3660,6 +3672,12 @@ static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent * return OPERATOR_CANCELLED; } +static bool redo_last_poll(bContext *C) +{ + wmWindowManager *wm = CTX_wm_manager(C); + return ED_operator_screenactive(C) && !BLI_listbase_is_empty(&wm->operators); +} + static void SCREEN_OT_redo_last(wmOperatorType *ot) { /* identifiers */ @@ -3670,7 +3688,7 @@ static void SCREEN_OT_redo_last(wmOperatorType *ot) /* api callbacks */ ot->invoke = redo_last_invoke; - ot->poll = ED_operator_screenactive; + ot->poll = redo_last_poll; } /** \} */ |