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:
@@ -52,25 +52,19 @@ def _check_axis_conversion(op):
|
||||
|
||||
|
||||
class ExportHelper:
|
||||
filepath = StringProperty(
|
||||
filepath: StringProperty(
|
||||
name="File Path",
|
||||
description="Filepath used for exporting the file",
|
||||
maxlen=1024,
|
||||
subtype='FILE_PATH',
|
||||
)
|
||||
check_existing = BoolProperty(
|
||||
check_existing: BoolProperty(
|
||||
name="Check Existing",
|
||||
description="Check and warn on overwriting existing files",
|
||||
default=True,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
|
||||
# needed for mix-ins
|
||||
order = [
|
||||
"filepath",
|
||||
"check_existing",
|
||||
]
|
||||
|
||||
# subclasses can override with decorator
|
||||
# True == use ext, False == no ext, None == do nothing.
|
||||
check_extension = True
|
||||
@@ -112,18 +106,13 @@ class ExportHelper:
|
||||
|
||||
|
||||
class ImportHelper:
|
||||
filepath = StringProperty(
|
||||
filepath: StringProperty(
|
||||
name="File Path",
|
||||
description="Filepath used for importing the file",
|
||||
maxlen=1024,
|
||||
subtype='FILE_PATH',
|
||||
)
|
||||
|
||||
# needed for mix-ins
|
||||
order = [
|
||||
"filepath",
|
||||
]
|
||||
|
||||
def invoke(self, context, event):
|
||||
context.window_manager.fileselect_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
@@ -173,11 +162,6 @@ def orientation_helper_factory(name, axis_forward='Y', axis_up='Z'):
|
||||
update=_update_axis_up,
|
||||
)
|
||||
|
||||
members["order"] = [
|
||||
"axis_forward",
|
||||
"axis_up",
|
||||
]
|
||||
|
||||
return type(name, (object,), members)
|
||||
|
||||
|
||||
|
||||
@@ -406,6 +406,7 @@ def keyconfig_test(kc):
|
||||
result = True
|
||||
return result
|
||||
|
||||
|
||||
# Note, we may eventually replace existing logic with this
|
||||
# so key configs are always data.
|
||||
from .keyconfig_utils_experimental import (
|
||||
|
||||
@@ -194,16 +194,16 @@ class AddObjectHelper:
|
||||
if not self.view_align:
|
||||
self.rotation.zero()
|
||||
|
||||
view_align = BoolProperty(
|
||||
view_align: BoolProperty(
|
||||
name="Align to View",
|
||||
default=False,
|
||||
update=view_align_update_callback,
|
||||
)
|
||||
location = FloatVectorProperty(
|
||||
location: FloatVectorProperty(
|
||||
name="Location",
|
||||
subtype='TRANSLATION',
|
||||
)
|
||||
rotation = FloatVectorProperty(
|
||||
rotation: FloatVectorProperty(
|
||||
name="Rotation",
|
||||
subtype='EULER',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user