Cleanup: style (80-width)
This commit is contained in:
parent
46dd04faed
commit
c31c53983e
|
@ -36,7 +36,8 @@ from bpy.props import (
|
|||
class NodeSetting(PropertyGroup):
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Python expression to be evaluated as the initial node setting",
|
||||
description="Python expression to be evaluated "
|
||||
"as the initial node setting",
|
||||
default="",
|
||||
)
|
||||
|
||||
|
@ -68,12 +69,15 @@ class NodeAddOperator:
|
|||
# convert mouse position to the View2D for later node placement
|
||||
if context.region.type == 'WINDOW':
|
||||
# convert mouse position to the View2D for later node placement
|
||||
space.cursor_location_from_region(event.mouse_region_x, event.mouse_region_y)
|
||||
space.cursor_location_from_region(
|
||||
event.mouse_region_x, event.mouse_region_y)
|
||||
else:
|
||||
space.cursor_location = tree.view_center
|
||||
|
||||
# XXX explicit node_type argument is usually not necessary, but required to make search operator work:
|
||||
# add_search has to override the 'type' property since it's hardcoded in bpy_operator_wrap.c ...
|
||||
# XXX explicit node_type argument is usually not necessary,
|
||||
# but required to make search operator work:
|
||||
# add_search has to override the 'type' property
|
||||
# since it's hardcoded in bpy_operator_wrap.c ...
|
||||
def create_node(self, context, node_type=None):
|
||||
space = context.space_data
|
||||
tree = space.edit_tree
|
||||
|
@ -94,7 +98,9 @@ class NodeAddOperator:
|
|||
try:
|
||||
setattr(node, setting.name, value)
|
||||
except AttributeError as e:
|
||||
self.report({'ERROR_INVALID_INPUT'}, "Node has no attribute " + setting.name)
|
||||
self.report(
|
||||
{'ERROR_INVALID_INPUT'},
|
||||
"Node has no attribute " + setting.name)
|
||||
print(str(e))
|
||||
# Continue despite invalid attribute
|
||||
|
||||
|
@ -107,7 +113,8 @@ class NodeAddOperator:
|
|||
def poll(cls, context):
|
||||
space = context.space_data
|
||||
# needs active node editor and a tree to add nodes to
|
||||
return (space.type == 'NODE_EDITOR' and space.edit_tree and not space.edit_tree.library)
|
||||
return ((space.type == 'NODE_EDITOR') and
|
||||
space.edit_tree and not space.edit_tree.library)
|
||||
|
||||
# Default execute simply adds a node
|
||||
def execute(self, context):
|
||||
|
@ -187,7 +194,12 @@ class NODE_OT_add_search(NodeAddOperator, Operator):
|
|||
if isinstance(item, nodeitems_utils.NodeItem):
|
||||
nodetype = getattr(bpy.types, item.nodetype, None)
|
||||
if nodetype:
|
||||
enum_items.append((str(index), item.label, nodetype.bl_rna.description, index))
|
||||
enum_items.append(
|
||||
(str(index),
|
||||
item.label,
|
||||
nodetype.bl_rna.description,
|
||||
index,
|
||||
))
|
||||
return enum_items
|
||||
|
||||
# Look up the item based on index
|
||||
|
@ -220,7 +232,8 @@ class NODE_OT_add_search(NodeAddOperator, Operator):
|
|||
self.create_node(context, item.nodetype)
|
||||
|
||||
if self.use_transform:
|
||||
bpy.ops.node.translate_attach_remove_on_cancel('INVOKE_DEFAULT')
|
||||
bpy.ops.node.translate_attach_remove_on_cancel(
|
||||
'INVOKE_DEFAULT')
|
||||
|
||||
return {'FINISHED'}
|
||||
else:
|
||||
|
@ -243,7 +256,8 @@ class NODE_OT_collapse_hide_unused_toggle(Operator):
|
|||
def poll(cls, context):
|
||||
space = context.space_data
|
||||
# needs active node editor and a tree
|
||||
return (space.type == 'NODE_EDITOR' and space.edit_tree and not space.edit_tree.library)
|
||||
return ((space.type == 'NODE_EDITOR') and
|
||||
(space.edit_tree and not space.edit_tree.library))
|
||||
|
||||
def execute(self, context):
|
||||
space = context.space_data
|
||||
|
|
Loading…
Reference in New Issue