diff options
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 21 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 3 |
2 files changed, 9 insertions, 15 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index a6777d40398..6ebe1671afc 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -744,12 +744,16 @@ static bool wm_operator_register_check(wmWindowManager *wm, wmOperatorType *ot) return wm && (wm->op_undo_depth == 0) && (ot->flag & (OPTYPE_REGISTER | OPTYPE_UNDO)); } -static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat) +static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat, const bool store) { wmWindowManager *wm = CTX_wm_manager(C); op->customdata = NULL; + if (store) { + WM_operator_last_properties_store(op); + } + /* we don't want to do undo pushes for operators that are being * called from operators that already do an undo push. usually * this will happen for python operators that call C operators */ @@ -812,12 +816,7 @@ static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, cons wm_operator_reports(C, op, retval, false); if (retval & OPERATOR_FINISHED) { - if (store) { - if (wm->op_undo_depth == 0) { /* not called by py script */ - WM_operator_last_properties_store(op); - } - } - wm_operator_finished(C, op, repeat); + wm_operator_finished(C, op, repeat, store && wm->op_undo_depth == 0); } else if (repeat == 0) { /* warning: modal from exec is bad practice, but avoid crashing. */ @@ -1173,10 +1172,8 @@ static int wm_operator_invoke( /* do nothing, wm_operator_exec() has been called somewhere */ } else if (retval & OPERATOR_FINISHED) { - if (!is_nested_call) { /* not called by py script */ - WM_operator_last_properties_store(op); - } - wm_operator_finished(C, op, 0); + const bool store = !is_nested_call; + wm_operator_finished(C, op, false, store); } else if (retval & OPERATOR_RUNNING_MODAL) { /* take ownership of reports (in case python provided own) */ @@ -1752,7 +1749,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand /* important to run 'wm_operator_finished' before NULLing the context members */ if (retval & OPERATOR_FINISHED) { - wm_operator_finished(C, op, 0); + wm_operator_finished(C, op, false, true); handler->op = NULL; } else if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index e4776ea7b29..307c8b24c1e 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2491,9 +2491,6 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event) } case GESTURE_MODAL_CANCEL: case GESTURE_MODAL_CONFIRM: - /* Normally we wouldn't store last-properties on cancel, - * this is an exception since the circle tool is modal. */ - WM_operator_last_properties_store(op); wm_gesture_end(C, op); return OPERATOR_FINISHED; /* use finish or we don't get an undo */ } |