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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user