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>2012-11-14 10:13:42 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-14 10:13:42 +0400
commit4cd129bb508d75ff635199397e9ff17cebd0639e (patch)
tree20364d12dbbe6e034ad13fdb5763cc59e4ff76c0 /source/blender/windowmanager
parent697d29cbed037060a8d0ce3df7f12d39142b1361 (diff)
fix for the update issue reported in [#32452]
When blending shape key, opening the popup didnt execute anything - making it so pressing a button would update the result even if the value didnt change.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h1
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c28
2 files changed, 26 insertions, 3 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index c53c4dca74c..e35e3edfa33 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -181,6 +181,7 @@ int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const char imt
/* poll callback, context checks */
int WM_operator_winactive (struct bContext *C);
/* invoke callback, exec + redo popup */
+int WM_operator_props_popup_call(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
int WM_operator_props_popup (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
int WM_operator_props_dialog_popup (struct bContext *C, struct wmOperator *op, int width, int height);
int WM_operator_redo_popup (struct bContext *C, struct wmOperator *op);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 126d497e08e..035e9d44b02 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1201,8 +1201,11 @@ int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
return OPERATOR_RUNNING_MODAL;
}
-/* operator menu needs undo, for redo callback */
-int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+/**
+ * For use by #WM_operator_props_popup_call, #WM_operator_props_popup only.
+ *
+ * \note operator menu needs undo flag enabled , for redo callback */
+static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, const int do_call)
{
if ((op->type->flag & OPTYPE_REGISTER) == 0) {
@@ -1210,15 +1213,34 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
"Operator '%s' does not have register enabled, incorrect invoke function", op->type->idname);
return OPERATOR_CANCELLED;
}
-
+
ED_undo_push_op(C, op);
+
wm_operator_register(C, op);
uiPupBlock(C, wm_block_create_redo, op);
+ if (do_call) {
+ WM_operator_repeat(C, op);
+ }
+
return OPERATOR_RUNNING_MODAL;
}
+/* Same as WM_operator_props_popup but call the operator first,
+ * This way - the button values corraspond to the result of the operator.
+ * Without this, first access to a button will make the result jump,
+ * see [#32452] */
+int WM_operator_props_popup_call(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+ return wm_operator_props_popup_ex(C, op, TRUE);
+}
+
+int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+ return wm_operator_props_popup_ex(C, op, FALSE);
+}
+
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height)
{
wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup");