forked from bartvdbraak/blender
Add new operator, ED_OT_undo_redo, to allow py tools to trigger that action.
Patch D2430 by @raa, thanks.
This commit is contained in:
parent
934b3f3682
commit
bf7d7bc323
@ -60,6 +60,7 @@ void ED_undo_redo(struct bContext *C);
|
||||
void ED_OT_undo(struct wmOperatorType *ot);
|
||||
void ED_OT_undo_push(struct wmOperatorType *ot);
|
||||
void ED_OT_redo(struct wmOperatorType *ot);
|
||||
void ED_OT_undo_redo(struct wmOperatorType *ot);
|
||||
void ED_OT_undo_history(struct wmOperatorType *ot);
|
||||
|
||||
int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op);
|
||||
|
@ -4329,6 +4329,7 @@ void ED_operatortypes_screen(void)
|
||||
WM_operatortype_append(ED_OT_undo);
|
||||
WM_operatortype_append(ED_OT_undo_push);
|
||||
WM_operatortype_append(ED_OT_redo);
|
||||
WM_operatortype_append(ED_OT_undo_redo);
|
||||
WM_operatortype_append(ED_OT_undo_history);
|
||||
|
||||
WM_operatortype_append(ED_OT_flush_edits);
|
||||
|
@ -327,6 +327,13 @@ static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
return ed_undo_step(C, -1, NULL);
|
||||
}
|
||||
|
||||
static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
wmOperator *last_op = WM_operator_last_redo(C);
|
||||
const int ret = ED_undo_operator_repeat(C, last_op);
|
||||
return ret ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
||||
/* ********************** */
|
||||
|
||||
@ -369,6 +376,17 @@ void ED_OT_redo(wmOperatorType *ot)
|
||||
ot->poll = ED_operator_screenactive;
|
||||
}
|
||||
|
||||
void ED_OT_undo_redo(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Undo and Redo";
|
||||
ot->description = "Undo and redo previous action";
|
||||
ot->idname = "ED_OT_undo_redo";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = ed_undo_redo_exec;
|
||||
ot->poll = ED_operator_screenactive;
|
||||
}
|
||||
|
||||
/* ui callbacks should call this rather than calling WM_operator_repeat() themselves */
|
||||
int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
|
||||
|
Loading…
Reference in New Issue
Block a user