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-09-27 01:19:51 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-27 01:19:51 +0400
commit8a51d235e608dc45c30338aaaa74f925c185c73a (patch)
treed62a750e88fb3ea7fb52fcb9f498c7e60134421d /release/scripts/startup/bl_operators/node.py
parentdbeddcdbcef7d6622f08c4647e5253165dbebe07 (diff)
pep8 cleanup
Diffstat (limited to 'release/scripts/startup/bl_operators/node.py')
-rw-r--r--release/scripts/startup/bl_operators/node.py42
1 files changed, 29 insertions, 13 deletions
diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py
index ee005fcb8bb..fb264cb3429 100644
--- a/release/scripts/startup/bl_operators/node.py
+++ b/release/scripts/startup/bl_operators/node.py
@@ -22,12 +22,16 @@ import bpy
from bpy.types import Operator
from bpy.props import EnumProperty
-# XXX These node item lists should actually be generated by a callback at operator execution time (see node_type_items below),
-# using the active node tree from the context. Due to a difficult bug in bpy this is not possible (item list memory gets freed too early),
+# XXX These node item lists should actually be generated by a callback at
+# operator execution time (see node_type_items below),
+# using the active node tree from the context.
+# Due to a difficult bug in bpy this is not possible
+# (item list memory gets freed too early),
# so for now just copy the static item lists to these global variables.
#
-# In the custom_nodes branch, the static per-tree-type node items are replaced by a single independent type list anyway (with a poll function
-# to limit node types to the respective trees). So this workaround is only temporary.
+# In the custom_nodes branch, the static per-tree-type node items are replaced
+# by a single independent type list anyway (with a poll function to limit node
+# types to the respective trees). So this workaround is only temporary.
# lazy init
node_type_items_dict = {}
@@ -39,18 +43,21 @@ node_group_prefix = 'GROUP_'
# Generate a list of enum items for a given node class
# Copy existing type enum, adding a prefix to distinguish from node groups
-# Skip the base node group type, node groups will be added below for all existing group trees
+# Skip the base node group type,
+# node groups will be added below for all existing group trees
def node_type_items(node_class):
return [(node_type_prefix + item.identifier, item.name, item.description)
- for item in node_class.bl_rna.properties['type'].enum_items if item.identifier != 'GROUP']
+ for item in node_class.bl_rna.properties['type'].enum_items
+ if item.identifier != 'GROUP']
# Generate items for node group types
# Filter by the given tree_type
-# Node group trees don't have a description property yet (could add this as a custom property though)
+# Node group trees don't have a description property yet
+# (could add this as a custom property though)
def node_group_items(tree_type):
return [(node_group_prefix + group.name, group.name, '')
- for group in bpy.data.node_groups if group.type == tree_type]
+ for group in bpy.data.node_groups if group.type == tree_type]
# Returns the enum item list for the edited tree in the context
@@ -71,7 +78,11 @@ def node_type_items_cb(self, context):
})
# XXX Does not work correctly, see comment above
- #return [(item.identifier, item.name, item.description, item.value) for item in tree.nodes.bl_rna.functions['new'].parameters['type'].enum_items]
+ '''
+ return [(item.identifier, item.name, item.description, item.value)
+ for item in
+ tree.nodes.bl_rna.functions['new'].parameters['type'].enum_items]
+ '''
if tree.type in node_type_items_dict:
return node_type_items_dict[tree.type] + node_group_items(tree.type)
@@ -85,7 +96,8 @@ class NODE_OT_add_search(Operator):
bl_label = "Search and Add Node"
bl_options = {'REGISTER', 'UNDO'}
- # XXX this should be called 'node_type' but the operator search property is hardcoded to 'type' by a hack in bpy_operator_wrap.c ...
+ # XXX this should be called 'node_type' but the operator search
+ # property is hardcoded to 'type' by a hack in bpy_operator_wrap.c ...
type = EnumProperty(
name="Node Type",
description="Node type",
@@ -98,14 +110,17 @@ class NODE_OT_add_search(Operator):
space = context.space_data
tree = space.edit_tree
- # Enum item identifier has an additional prefix to distinguish base node types from node groups
+ # Enum item identifier has an additional prefix to
+ # distinguish base node types from node groups
item = self.type
if item.startswith(node_type_prefix):
# item means base node type
node = tree.nodes.new(type=item[len(node_type_prefix):])
elif item.startswith(node_group_prefix):
# item means node group type
- node = tree.nodes.new(type='GROUP', group=bpy.data.node_groups[item[len(node_group_prefix):]])
+ node = tree.nodes.new(
+ type='GROUP',
+ group=bpy.data.node_groups[item[len(node_group_prefix):]])
else:
return None
@@ -133,7 +148,8 @@ class NODE_OT_add_search(Operator):
v2d = context.region.view2d
# convert mouse position to the View2D for later node placement
- space.cursor_location = v2d.region_to_view(event.mouse_region_x, event.mouse_region_y)
+ space.cursor_location = v2d.region_to_view(event.mouse_region_x,
+ event.mouse_region_y)
context.window_manager.invoke_search_popup(self)
return {'CANCELLED'}