[Bf-blender-cvs] [285e09b] master: Fix T37149: Macros store settings from a cancelled operation

Campbell Barton noreply at git.blender.org
Fri Nov 29 06:02:16 CET 2013


Commit: 285e09bceb4d78cdefb046b5c58f8fa33a04ef05
Author: Campbell Barton
Date:   Fri Nov 29 16:01:03 2013 +1100
http://developer.blender.org/rB285e09bceb4d78cdefb046b5c58f8fa33a04ef05

Fix T37149: Macros store settings from a cancelled operation

===================================================================

M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/intern/wm_operators.c

===================================================================

diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 0e202fd..2402b8d 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -239,6 +239,7 @@ bool        WM_operator_properties_default(struct PointerRNA *ptr, const bool do
 void        WM_operator_properties_reset(struct wmOperator *op);
 void		WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
 void		WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot);
+void        WM_operator_properties_clear(struct PointerRNA *ptr);
 void		WM_operator_properties_free(struct PointerRNA *ptr);
 void		WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type, short action, short flag, short display);
 void        WM_operator_properties_border(struct wmOperatorType *ot);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index a4c389d..5d2edce 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -296,6 +296,11 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event)
 		retval = opm->type->modal(C, opm, event);
 		OPERATOR_RETVAL_CHECK(retval);
 
+		/* if we're halfway through using a tool and cancel it, clear the options [#37149] */
+		if (retval & OPERATOR_CANCELLED) {
+			WM_operator_properties_clear(opm->ptr);
+		}
+
 		/* if this one is done but it's not the last operator in the macro */
 		if ((retval & OPERATOR_FINISHED) && opm->next) {
 			MacroData *md = op->customdata;
@@ -918,6 +923,15 @@ void WM_operator_properties_reset(wmOperator *op)
 	}
 }
 
+void WM_operator_properties_clear(PointerRNA *ptr)
+{
+	IDProperty *properties = ptr->data;
+
+	if (properties) {
+		IDP_ClearProperty(properties);
+	}
+}
+
 void WM_operator_properties_free(PointerRNA *ptr)
 {
 	IDProperty *properties = ptr->data;




More information about the Bf-blender-cvs mailing list