diff --git a/__init__.py b/__init__.py index 7de659b..f49db16 100755 --- a/__init__.py +++ b/__init__.py @@ -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'}) @@ -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()