And and remove post_load handler in register and unregister
This commit is contained in:
parent
d2c7fc7811
commit
2a39e6360b
1 changed files with 19 additions and 19 deletions
|
@ -196,24 +196,6 @@ classes = [
|
|||
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():
|
||||
cwd = os.path.dirname(os.path.realpath(__file__))
|
||||
blendfile = cwd + "\\BitsquidPBR.blend"
|
||||
|
@ -233,7 +215,25 @@ def import_template():
|
|||
def load_handler(dummy):
|
||||
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__":
|
||||
register()
|
||||
|
|
Loading…
Add table
Reference in a new issue