Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index fe79798c3b7..e842db64015 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -773,12 +773,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 */
@@ -841,12 +845,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. */
@@ -1202,10 +1201,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) */
@@ -1811,7 +1808,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)) {