diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-15 07:11:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-15 07:11:48 +0400 |
commit | ea610e655cd8b8f9fb97f0a9a4fc5fd46418bd9e (patch) | |
tree | c1a3582f1167f778bf5845e64e127c0560b0c42e /release/scripts/templates_py/custom_nodes.py | |
parent | 3cf39fc72a36bab1c5b82ae96cffe7dd01ce7260 (diff) |
Style cleanup: C & pep8
Diffstat (limited to 'release/scripts/templates_py/custom_nodes.py')
-rw-r--r-- | release/scripts/templates_py/custom_nodes.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py index bf89c0debad..992ef734859 100644 --- a/release/scripts/templates_py/custom_nodes.py +++ b/release/scripts/templates_py/custom_nodes.py @@ -49,13 +49,15 @@ class MyCustomSocket(NodeSocket): def draw_color(self, context, node): return (1.0, 0.4, 0.216, 0.5) + # Mix-in class for all custom nodes in this tree type. # Defines a poll function to enable instantiation. -class MyCustomTreeNode : +class MyCustomTreeNode: @classmethod def poll(cls, ntree): return ntree.bl_idname == 'CustomTreeType' + # Derived from the Node base type. class MyCustomNode(Node, MyCustomTreeNode): # === Basics === @@ -123,6 +125,7 @@ class MyCustomNode(Node, MyCustomTreeNode): import nodeitems_utils from nodeitems_utils import NodeCategory, NodeItem + # our own base class with an appropriate poll function, # so the categories only show up in our own tree type class MyNodeCategory(NodeCategory): @@ -143,12 +146,12 @@ node_categories = [ # NB: settings values are stored as string expressions, # for this reason they should be converted to strings using repr() NodeItem("CustomNodeType", label="Node A", settings={ - "myStringProperty" : repr("Lorem ipsum dolor sit amet"), - "myFloatProperty" : repr(1.0), + "myStringProperty": repr("Lorem ipsum dolor sit amet"), + "myFloatProperty": repr(1.0), }), NodeItem("CustomNodeType", label="Node B", settings={ - "myStringProperty" : repr("consectetur adipisicing elit"), - "myFloatProperty" : repr(2.0), + "myStringProperty": repr("consectetur adipisicing elit"), + "myFloatProperty": repr(2.0), }), ]), ] |