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:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-09-17 17:07:48 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-09-17 17:07:48 +0400
commit29b546fe7f9ee4f03f785c7f985a9a15493a0afc (patch)
tree6ca380f0406e0de167a292779e2547b18aa30734 /release/scripts/startup/bl_operators/node.py
parent40b5b665273eb84771f41dd4a60db98e2cb845f5 (diff)
Fix for #36739: Delete new nodes added via the Add menu or toolbar if the subsequent transform operator is cancelled. This prevents ugly situations where nodes stick "under" the toolbar after clicking a
wrong button. Works by adding a flag to transform operators "remove_on_cancel". This is currently only used for node transforms, the idea is that if set, the operator will remove the transformed elements when it is cancelled. It's not possible to do that in the original NODE_OT_add_node operator, because transform is modal and there is no way of reacting to a cancel outside of the transform itself (previous attempt used a macro operator, but that also doesn't work because subsequent operators don't get executed if the previous transform cancels).
Diffstat (limited to 'release/scripts/startup/bl_operators/node.py')
-rw-r--r--release/scripts/startup/bl_operators/node.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py
index 16349c27e39..6627e814499 100644
--- a/release/scripts/startup/bl_operators/node.py
+++ b/release/scripts/startup/bl_operators/node.py
@@ -123,7 +123,8 @@ class NodeAddOperator():
result = self.execute(context)
if self.use_transform and ('FINISHED' in result):
- bpy.ops.transform.translate('INVOKE_DEFAULT')
+ # removes the node again if transform is cancelled
+ bpy.ops.transform.translate('INVOKE_DEFAULT', remove_on_cancel = True)
return result