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:
authorCampbell Barton <ideasman42@gmail.com>2014-01-28 19:52:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-28 19:54:46 +0400
commit9a1dcfbf2d8a625806b850b70b8e5f878443f870 (patch)
tree6ce8f7e041bb9346fe1f774d98c85312b6b7137d /source/blender/windowmanager
parenta283b099b13a24b0361f9c063caa9426a70de1e4 (diff)
Fix T38367: operators activated from popups didnt reuse settings
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h1
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c21
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c4
3 files changed, 18 insertions, 8 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index ed86cc01a16..9e960f89f55 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -227,6 +227,7 @@ struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType *
int WM_operator_poll (struct bContext *C, struct wmOperatorType *ot);
int WM_operator_poll_context(struct bContext *C, struct wmOperatorType *ot, short context);
+int WM_operator_call_ex(struct bContext *C, struct wmOperator *op, const bool store);
int WM_operator_call (struct bContext *C, struct wmOperator *op);
int WM_operator_call_notest(struct bContext *C, struct wmOperator *op);
int WM_operator_repeat (struct bContext *C, struct wmOperator *op);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 9e271feca81..be4064a375f 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -649,7 +649,7 @@ static bool wm_operator_register_check(wmWindowManager *wm, wmOperatorType *ot)
return wm && (wm->op_undo_depth == 0) && (ot->flag & OPTYPE_REGISTER);
}
-static void wm_operator_finished(bContext *C, wmOperator *op, int repeat)
+static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat)
{
wmWindowManager *wm = CTX_wm_manager(C);
@@ -683,7 +683,7 @@ static void wm_operator_finished(bContext *C, wmOperator *op, int repeat)
}
/* if repeat is true, it doesn't register again, nor does it free */
-static int wm_operator_exec(bContext *C, wmOperator *op, int repeat)
+static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, const bool store)
{
wmWindowManager *wm = CTX_wm_manager(C);
int retval = OPERATOR_CANCELLED;
@@ -714,7 +714,7 @@ static int wm_operator_exec(bContext *C, wmOperator *op, int repeat)
wm_operator_reports(C, op, retval, FALSE);
if (retval & OPERATOR_FINISHED) {
- if (repeat) {
+ if (store) {
if (wm->op_undo_depth == 0) { /* not called by py script */
WM_operator_last_properties_store(op);
}
@@ -743,12 +743,21 @@ static int wm_operator_exec_notest(bContext *C, wmOperator *op)
return retval;
}
-/* for running operators with frozen context (modal handlers, menus)
+/**
+ * for running operators with frozen context (modal handlers, menus)
+ *
+ * \param store, Store settings for re-use.
*
* warning: do not use this within an operator to call its self! [#29537] */
+int WM_operator_call_ex(bContext *C, wmOperator *op,
+ const bool store)
+{
+ return wm_operator_exec(C, op, false, store);
+}
+
int WM_operator_call(bContext *C, wmOperator *op)
{
- return wm_operator_exec(C, op, 0);
+ return WM_operator_call_ex(C, op, false);
}
/* this is intended to be used when an invoke operator wants to call exec on its self
@@ -762,7 +771,7 @@ int WM_operator_call_notest(bContext *C, wmOperator *op)
/* do this operator again, put here so it can share above code */
int WM_operator_repeat(bContext *C, wmOperator *op)
{
- return wm_operator_exec(C, op, 1);
+ return wm_operator_exec(C, op, true, true);
}
/* TRUE if WM_operator_repeat can run
* simple check for now but may become more involved.
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 64adb6d0fab..06d42659fd3 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1434,7 +1434,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
wmOpPopUp *data = arg1;
uiBlock *block = arg2;
- WM_operator_call(C, data->op);
+ WM_operator_call_ex(C, data->op, true);
/* let execute handle freeing it */
//data->free_op = FALSE;
@@ -1548,7 +1548,7 @@ static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
wmOperator *op = data->op;
if (op && retval > 0)
- WM_operator_call(C, op);
+ WM_operator_call_ex(C, op, true);
MEM_freeN(data);
}