style cleanup: also change node selection method not to compare nodes a lot.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 12 Dec 2012 15:41:15 +0000 (15:41 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 12 Dec 2012 15:41:15 +0000 (15:41 +0000)
release/scripts/startup/bl_operators/node.py

index 38adcdf7368e85c07170818bf456b596e48e862b..071eb2e75f9aa6121a9b4f17445c4c477c4d927d 100644 (file)
@@ -37,11 +37,13 @@ class NodeAddOperator():
         space = context.space_data
         tree = space.edit_tree
 
-        node = tree.nodes.new(type=node_type)
-
         # select only the new node
         for n in tree.nodes:
-            n.select = (n == node)
+            n.select = False
+
+        node = tree.nodes.new(type=node_type)
+
+        node.select = True
         tree.nodes.active = node
         node.location = space.cursor_location
         return node
@@ -64,11 +66,15 @@ class NODE_OT_add_node(NodeAddOperator, Operator):
     bl_idname = "node.add_node"
     bl_label = "Add Node"
 
-    type = StringProperty(name="Node Type", description="Node type")
-    
+    type = StringProperty(
+            name="Node Type",
+            description="Node type",
+            )
     # optional group tree parameter for group nodes
-    group_tree = StringProperty(name="Group tree", description="Group node tree name")
-
+    group_tree = StringProperty(
+            name="Group tree",
+            description="Group node tree name",
+            )
     def execute(self, context):
         node = self.create_node(context, self.type)
 
@@ -85,10 +91,15 @@ class NODE_OT_add_node_move(NODE_OT_add_node):
     bl_idname = "node.add_node_move"
     bl_label = "Add Node and Move"
 
-    type = StringProperty(name="Node Type", description="Node type")
-    
+    type = StringProperty(
+            name="Node Type",
+            description="Node type",
+            )
     # optional group tree parameter for group nodes
-    group_tree = StringProperty(name="Group tree", description="Group node tree name")
+    group_tree = StringProperty(
+            name="Group tree",
+            description="Group node tree name",
+            )
 
     def invoke(self, context, event):
         self.store_mouse_cursor(context, event)