[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60575] trunk/blender/release/scripts/ startup/bl_operators/node.py: Check the node Add operator' s type property before attempting to create a new node.

Lukas Toenne lukas.toenne at googlemail.com
Sun Oct 6 12:49:41 CEST 2013


Revision: 60575
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60575
Author:   lukastoenne
Date:     2013-10-06 10:49:40 +0000 (Sun, 06 Oct 2013)
Log Message:
-----------
Check the node Add operator's type property before attempting to create a new node. This prevents python exceptions when calling it from the search menu, where the node type is unspecified.
Reported by Sebastian Koenig in unrelated bug report #36968.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_operators/node.py

Modified: trunk/blender/release/scripts/startup/bl_operators/node.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/node.py	2013-10-06 10:28:09 UTC (rev 60574)
+++ trunk/blender/release/scripts/startup/bl_operators/node.py	2013-10-06 10:49:40 UTC (rev 60575)
@@ -113,8 +113,11 @@
 
     # Default execute simply adds a node
     def execute(self, context):
-        self.create_node(context)
-        return {'FINISHED'}
+        if self.properties.is_property_set("type"):
+            self.create_node(context)
+            return {'FINISHED'}
+        else:
+            return {'CANCELLED'}
 
     # Default invoke stores the mouse position to place the node correctly
     # and optionally invokes the transform operator




More information about the Bf-blender-cvs mailing list