diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-11 23:18:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-11 23:18:09 +0300 |
commit | 09aa799e5331a9da666f8a6325b038a866b1f35d (patch) | |
tree | ccff0086f70ea7929554a7e4c90bd1182f125ba6 /release/scripts/templates_py/custom_nodes.py | |
parent | e3c85aaca74fc7bd2a9da43a0396a886363bc93d (diff) |
PyAPI: Use annotations for RNA definitions
- Logical use of fields since they define type information.
- Avoids using ordered-dict metaclass.
Properties using regular assignments will print a warning and load,
however the order is undefined.
Diffstat (limited to 'release/scripts/templates_py/custom_nodes.py')
-rw-r--r-- | release/scripts/templates_py/custom_nodes.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py index 23d8ee55e72..7e4e89dafeb 100644 --- a/release/scripts/templates_py/custom_nodes.py +++ b/release/scripts/templates_py/custom_nodes.py @@ -30,10 +30,15 @@ class MyCustomSocket(NodeSocket): ('DOWN', "Down", "Where your feet are"), ('UP', "Up", "Where your head should be"), ('LEFT', "Left", "Not right"), - ('RIGHT', "Right", "Not left") + ('RIGHT', "Right", "Not left"), ) - my_enum_prop = bpy.props.EnumProperty(name="Direction", description="Just an example", items=my_items, default='UP') + my_enum_prop: bpy.props.EnumProperty( + name="Direction", + description="Just an example", + items=my_items, + default='UP', + ) # Optional function for drawing the socket input value def draw(self, context, layout, node, text): @@ -71,8 +76,8 @@ class MyCustomNode(Node, MyCustomTreeNode): # These work just like custom properties in ID data blocks # Extensive information can be found under # http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Properties - my_string_prop = bpy.props.StringProperty() - my_float_prop = bpy.props.FloatProperty(default=3.1415926) + my_string_prop: bpy.props.StringProperty() + my_float_prop: bpy.props.FloatProperty(default=3.1415926) # === Optional Functions === # Initialization function, called when a new node is created. |