[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52200] trunk/blender/source/blender: fix for the update issue reported in [#32452]
Campbell Barton
ideasman42 at gmail.com
Wed Nov 14 07:13:48 CET 2012
Revision: 52200
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52200
Author: campbellbarton
Date: 2012-11-14 06:13:42 +0000 (Wed, 14 Nov 2012)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/editors/mesh/editmesh_tools.c
trunk/blender/source/blender/windowmanager/WM_api.h
trunk/blender/source/blender/windowmanager/intern/wm_operators.c
Modified: trunk/blender/source/blender/editors/mesh/editmesh_tools.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_tools.c 2012-11-14 04:02:43 UTC (rev 52199)
+++ trunk/blender/source/blender/editors/mesh/editmesh_tools.c 2012-11-14 06:13:42 UTC (rev 52200)
@@ -2438,7 +2438,7 @@
totshape = CustomData_number_of_layers(&em->bm->vdata, CD_SHAPEKEY);
if (totshape == 0 || shape < 0 || shape >= totshape)
return OPERATOR_CANCELLED;
-
+
/* get shape key - needed for finding reference shape (for add mode only) */
if (key) {
kb = BLI_findlink(&key->block, shape);
@@ -2517,7 +2517,7 @@
/* api callbacks */
ot->exec = edbm_blend_from_shape_exec;
- ot->invoke = WM_operator_props_popup;
+ ot->invoke = WM_operator_props_popup_call;
ot->poll = ED_operator_editmesh;
/* flags */
Modified: trunk/blender/source/blender/windowmanager/WM_api.h
===================================================================
--- trunk/blender/source/blender/windowmanager/WM_api.h 2012-11-14 04:02:43 UTC (rev 52199)
+++ trunk/blender/source/blender/windowmanager/WM_api.h 2012-11-14 06:13:42 UTC (rev 52200)
@@ -181,6 +181,7 @@
/* 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);
Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2012-11-14 04:02:43 UTC (rev 52199)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2012-11-14 06:13:42 UTC (rev 52200)
@@ -1201,8 +1201,11 @@
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 @@
"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");
More information about the Bf-blender-cvs
mailing list