Fix T37149: Macros store settings from a cancelled operation

This commit is contained in:
Campbell Barton 2013-11-29 16:01:03 +11:00
parent fd88ce4d73
commit 285e09bceb
Notes: blender-bot 2023-02-14 11:42:38 +01:00
Referenced by issue #37149, Loop cut tool- Factor does not update to 0 if middle muse its use to apply
2 changed files with 15 additions and 0 deletions

View File

@ -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);

View File

@ -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;