Skip to content

Commit

Permalink
Importer: Remove console spam for missing rna ui property
Browse files Browse the repository at this point in the history
  • Loading branch information
loonaticx committed Feb 22, 2024
1 parent f112fd7 commit a6dfe39
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ class IMPORT_OT_egg(bpy.types.Operator, ImportHelper):
filename_ext = ".egg"
filter_glob = props.StringProperty(default="*.egg;*.egg.pz;*.egg.gz", options={'HIDDEN'})

"""
Note:
Blender versions >= 2.8 use Python's type annotations (PEP 526), meaning we need to use colons instead of equals.
If we do not use colons for >= 2.8, it may still run, but can spam the console with something like:
rna_uiItemR: property not found: IMPORT_SCENE_OT_egg.auto_bind
In <2.8 versions of Blender, we must use = for assigning custom properties, otherwise we will get a SyntaxError.
"""

if bpy.app.version < (2, 80):
directory = props.StringProperty(name="Directory", options={'HIDDEN'})
files = props.CollectionProperty(type=bpy.types.OperatorFileListElement, options={'HIDDEN'})
Expand All @@ -52,16 +61,28 @@ class IMPORT_OT_egg(bpy.types.Operator, ImportHelper):
except SyntaxError:
pass

load_external = props.BoolProperty(
name="Load external references",
description="Loads other .egg files referenced by this file as separate scenes, "
"and instantiates them using DupliGroups."
)
auto_bind = props.BoolProperty(
name="Auto bind",
default=True,
description="Automatically tries to bind actions to armatures."
)
if bpy.app.version >= (2, 80):
load_external: props.BoolProperty(
name = "Load external references",
description = "Loads other .egg files referenced by this file as separate scenes, "
"and instantiates them using DupliGroups."
)
auto_bind: props.BoolProperty(
name = "Auto bind",
default = True,
description = "Automatically tries to bind actions to armatures."
)
else:
load_external = props.BoolProperty(
name="Load external references",
description="Loads other .egg files referenced by this file as separate scenes, "
"and instantiates them using DupliGroups."
)
auto_bind = props.BoolProperty(
name="Auto bind",
default=True,
description="Automatically tries to bind actions to armatures."
)

def execute(self, context):
context = importer.EggContext()
Expand Down

0 comments on commit a6dfe39

Please sign in to comment.