1
Fork 0

And and remove post_load handler in register and unregister

This commit is contained in:
Dan Reeves 2021-04-18 20:11:29 +01:00
parent d2c7fc7811
commit 2a39e6360b

View file

@ -196,24 +196,6 @@ classes = [
MATERIAL_OT_bitsquid_export, MATERIAL_OT_bitsquid_export,
] ]
def register():
from bpy.utils import register_class
for cls in classes:
register_class(cls)
bpy.types.Scene.bitsquid = PointerProperty(type=BitsquidSettings)
bpy.types.Object.bitsquid = PointerProperty(type=BitsquidObjectSettings)
bpy.types.Material.bitsquid = PointerProperty(type=BitsquidMaterialSettings)
def unregister():
del bpy.types.Scene.bitsquid
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)
def import_template(): def import_template():
cwd = os.path.dirname(os.path.realpath(__file__)) cwd = os.path.dirname(os.path.realpath(__file__))
blendfile = cwd + "\\BitsquidPBR.blend" blendfile = cwd + "\\BitsquidPBR.blend"
@ -233,7 +215,25 @@ def import_template():
def load_handler(dummy): def load_handler(dummy):
import_template() import_template()
bpy.app.handlers.load_post.append(load_handler) def register():
from bpy.utils import register_class
for cls in classes:
register_class(cls)
bpy.types.Scene.bitsquid = PointerProperty(type=BitsquidSettings)
bpy.types.Object.bitsquid = PointerProperty(type=BitsquidObjectSettings)
bpy.types.Material.bitsquid = PointerProperty(type=BitsquidMaterialSettings)
bpy.app.handlers.load_post.append(load_handler)
def unregister():
del bpy.types.Scene.bitsquid
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)
bpy.app.handlers.load_post.remove(load_handler)
if __name__ == "__main__": if __name__ == "__main__":
register() register()