From 3c4df7dd204144f563183b594e10d0c8ceec06dc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 12 Dec 2012 15:41:15 +0000 Subject: style cleanup: also change node selection method not to compare nodes a lot. --- release/scripts/startup/bl_operators/node.py | 31 +++++++++++++++++++--------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'release') diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py index 38adcdf7368..071eb2e75f9 100644 --- a/release/scripts/startup/bl_operators/node.py +++ b/release/scripts/startup/bl_operators/node.py @@ -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) -- cgit v1.2.3