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-03-22 06:00:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-22 06:00:14 +0400
commit23c8298ca042db6e00f319663fbe3f82c87db68e (patch)
tree81cefc0eee49c3b0d0337a2bfa406fada6b82102 /source/blender/windowmanager
parentb6c2f9ddabd54530906661150640daa31b50e1e9 (diff)
fix for python called operators getting/setting the operator last used state, also set object.vertex_group_assign.new to false when accessed from blenders UI
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 1c446346dc1..fcdebff82be 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -751,7 +751,10 @@ int WM_operator_last_properties_init(wmOperator *op)
if (op->type->last_properties) {
PropertyRNA *iterprop;
- iterprop= RNA_struct_iterator_property(op->type->srna);
+
+ if (G.f & G_DEBUG) printf("%s: loading previous properties for '%s'\n", __func__, op->type->idname);
+
+ iterprop = RNA_struct_iterator_property(op->type->srna);
RNA_PROP_BEGIN(op->ptr, itemptr, iterprop) {
PropertyRNA *prop= itemptr.data;
@@ -787,6 +790,7 @@ int WM_operator_last_properties_store(wmOperator *op)
}
if (op->properties) {
+ if (G.f & G_DEBUG) printf("%s: storing properties for '%s'\n", __func__, op->type->idname);
op->type->last_properties = IDP_CopyProperty(op->properties);
return TRUE;
}
@@ -1073,8 +1077,18 @@ int WM_operator_call_py(bContext *C, wmOperatorType *ot, int context, PointerRNA
printf("error \"%s\" operator has no exec function, python cannot call it\n", op->type->name);
#endif
- retval= wm_operator_call_internal(C, ot, properties, reports, context, FALSE);
+ /* not especially nice using undo depth here, its used so py never
+ * triggers undo or stores operators last used state.
+ *
+ * we could have some more obvious way of doing this like passing a flag.
+ */
+ wmWindowManager *wm = CTX_wm_manager(C);
+ if (wm) wm->op_undo_depth++;
+
+ retval = wm_operator_call_internal(C, ot, properties, reports, context, FALSE);
+ if (wm == CTX_wm_manager(C)) wm->op_undo_depth--;
+
/* keep the reports around if needed later */
if ( (retval & OPERATOR_RUNNING_MODAL) ||
((retval & OPERATOR_FINISHED) && wm_operator_register_check(CTX_wm_manager(C), ot))