Revert "UI: Edit Menu Operator Polling"

This reverts part of commit b7eba20236. Polling
is causing issues in scripts, and the minor usability improvements are not worth
the extra work this may cause at this point in the release cycle.

Fixes T65149
This commit is contained in:
Brecht Van Lommel 2019-05-27 00:29:34 +02:00
parent d595382288
commit d525c76003
Notes: blender-bot 2023-02-14 02:25:39 +01:00
Referenced by issue #65273, Blender 2.8 Crash while connecting Shader (Eevee)
Referenced by issue #65221, armature selection bug
Referenced by issue #65195, error in mesh view in sculpt mode
Referenced by issue #65200, Crash by hiting "tab" after sculpting with dyntopo.
Referenced by issue #65205, "To sphere" operation unexpected behavior with proportional editing on
Referenced by issue #65149, Undo in script does not work in Blender 2.8
2 changed files with 6 additions and 52 deletions

View File

@ -3564,12 +3564,6 @@ 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 */
@ -3580,7 +3574,7 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot)
/* api callbacks */
ot->exec = repeat_last_exec;
ot->poll = repeat_last_poll;
ot->poll = ED_operator_screenactive;
}
/** \} */
@ -3633,12 +3627,6 @@ 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 */
@ -3650,7 +3638,7 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot)
ot->invoke = repeat_history_invoke;
ot->exec = repeat_history_exec;
ot->poll = repeat_history_poll;
ot->poll = ED_operator_screenactive;
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
}
@ -3672,12 +3660,6 @@ 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 */
@ -3688,7 +3670,7 @@ static void SCREEN_OT_redo_last(wmOperatorType *ot)
/* api callbacks */
ot->invoke = redo_last_invoke;
ot->poll = redo_last_poll;
ot->poll = ED_operator_screenactive;
}
/** \} */

View File

@ -392,15 +392,6 @@ static bool ed_undo_redo_poll(bContext *C)
WM_operator_check_ui_enabled(C, last_op->type->name));
}
static bool ed_undo_poll(bContext *C)
{
if (!ed_undo_is_init_and_screenactive_poll(C)) {
return false;
}
UndoStack *undo_stack = CTX_wm_manager(C)->undo_stack;
return (undo_stack->step_active != NULL) && (undo_stack->step_active->prev != NULL);
}
void ED_OT_undo(wmOperatorType *ot)
{
/* identifiers */
@ -410,7 +401,7 @@ void ED_OT_undo(wmOperatorType *ot)
/* api callbacks */
ot->exec = ed_undo_exec;
ot->poll = ed_undo_poll;
ot->poll = ed_undo_is_init_and_screenactive_poll;
}
void ED_OT_undo_push(wmOperatorType *ot)
@ -435,15 +426,6 @@ void ED_OT_undo_push(wmOperatorType *ot)
"");
}
static bool ed_redo_poll(bContext *C)
{
if (!ed_undo_is_init_and_screenactive_poll(C)) {
return false;
}
UndoStack *undo_stack = CTX_wm_manager(C)->undo_stack;
return (undo_stack->step_active != NULL) && (undo_stack->step_active->next != NULL);
}
void ED_OT_redo(wmOperatorType *ot)
{
/* identifiers */
@ -453,7 +435,7 @@ void ED_OT_redo(wmOperatorType *ot)
/* api callbacks */
ot->exec = ed_redo_exec;
ot->poll = ed_redo_poll;
ot->poll = ed_undo_is_init_and_screenactive_poll;
}
void ED_OT_undo_redo(wmOperatorType *ot)
@ -651,16 +633,6 @@ static int undo_history_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
static bool undo_history_poll(bContext *C)
{
if (!ed_undo_is_init_and_screenactive_poll(C)) {
return false;
}
UndoStack *undo_stack = CTX_wm_manager(C)->undo_stack;
/* more than just original state entry */
return BLI_listbase_count_at_most(&undo_stack->steps, 2) > 1;
}
void ED_OT_undo_history(wmOperatorType *ot)
{
/* identifiers */
@ -671,7 +643,7 @@ void ED_OT_undo_history(wmOperatorType *ot)
/* api callbacks */
ot->invoke = undo_history_invoke;
ot->exec = undo_history_exec;
ot->poll = undo_history_poll;
ot->poll = ed_undo_is_init_and_screenactive_poll;
RNA_def_int(ot->srna, "item", 0, 0, INT_MAX, "Item", "", 0, INT_MAX);
}