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.
This commit is contained in:
2018-07-11 22:18:09 +02:00
parent e3c85aaca7
commit 09aa799e53
39 changed files with 339 additions and 366 deletions

View File

@@ -34,7 +34,7 @@ from bpy.props import (
class NodeSetting(PropertyGroup):
value = StringProperty(
value: StringProperty(
name="Value",
description="Python expression to be evaluated "
"as the initial node setting",
@@ -45,16 +45,16 @@ class NodeSetting(PropertyGroup):
# Base class for node 'Add' operators
class NodeAddOperator:
type = StringProperty(
type: StringProperty(
name="Node Type",
description="Node type",
)
use_transform = BoolProperty(
use_transform: BoolProperty(
name="Use Transform",
description="Start transform operator after inserting the node",
default=False,
)
settings = CollectionProperty(
settings: CollectionProperty(
name="Settings",
description="Settings to be applied on the newly created node",
type=NodeSetting,
@@ -152,7 +152,7 @@ class NODE_OT_add_and_link_node(NodeAddOperator, Operator):
bl_label = "Add and Link Node"
bl_options = {'REGISTER', 'UNDO'}
link_socket_index = IntProperty(
link_socket_index: IntProperty(
name="Link Socket Index",
description="Index of the socket to link",
)
@@ -210,7 +210,7 @@ class NODE_OT_add_search(NodeAddOperator, Operator):
return item
return None
node_item = EnumProperty(
node_item: EnumProperty(
name="Node Type",
description="Node type",
items=node_enum_items,