Style cleanup: C & pep8

This commit is contained in:
Campbell Barton
2014-04-15 13:11:48 +10:00
parent 3cf39fc72a
commit ea610e655c
11 changed files with 29 additions and 25 deletions

View File

@@ -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),
}),
]),
]