Files
Avatar-Toolkit/__init__.py
T
Yusarina 6c918b8209 Very Basic MMD Options Panel (MASSIVE WIP)
This is a massive WIP most options don't work yet. However this is the start of it.
2024-09-25 23:48:16 +01:00

51 lines
1.7 KiB
Python

if "bpy" not in locals():
import bpy
from . import ui
from . import core
from . import functions
from .core import register
from .core.register import __bl_ordered_classes
from .core import properties
from .core import addon_preferences
else:
import importlib
importlib.reload(ui)
importlib.reload(core)
importlib.reload(functions)
importlib.reload(properties)
importlib.reload(addon_preferences)
def register():
print("Registering Avatar Toolkit")
# Register the addon properties
properties.register()
# Load the translations
functions.translations.load_translations()
# Order the classes before registration
core.register.order_classes()
# Register the UI classes
for cls in core.register.__bl_ordered_classes:
print("registering " + str(cls))
bpy.utils.register_class(cls)
#finally register properties that may use some classes.
core.register.register_properties()
from .functions.mesh_tools import AvatarToolkit_OT_ApplyShapeKey
bpy.types.MESH_MT_shape_key_context_menu.append((lambda self, context: self.layout.separator()))
bpy.types.MESH_MT_shape_key_context_menu.append((lambda self, context: self.layout.operator(AvatarToolkit_OT_ApplyShapeKey.bl_idname, icon="KEY_HLT")))
def unregister():
print("Unregistering Avatar Toolkit")
# Unregister the UI classes
# Iterate over the classes to unregister in reverse order and unregister them
for cls in reversed(list(__bl_ordered_classes)):
bpy.utils.unregister_class(cls)
print("unregistering " + str(cls))
core.register.unregister_properties()
properties.unregister()