44 lines
1.0 KiB
Python
44 lines
1.0 KiB
Python
if "bpy" in locals():
|
|
import importlib
|
|
importlib.reload(globals)
|
|
importlib.reload(properties)
|
|
importlib.reload(operators)
|
|
importlib.reload(panels)
|
|
importlib.reload(preferences)
|
|
else:
|
|
from . import globals
|
|
from . import properties
|
|
from . import operators
|
|
from . import panels
|
|
from . import preferences
|
|
|
|
import bpy
|
|
|
|
classes = (
|
|
*properties.classes,
|
|
*operators.classes,
|
|
*panels.classes,
|
|
preferences.D2ToolboxPreferences,
|
|
)
|
|
|
|
def register():
|
|
for cls in classes:
|
|
bpy.utils.register_class(cls)
|
|
|
|
bpy.types.Scene.d2toolbox = bpy.props.PointerProperty(type=properties.D2ToolboxProperties)
|
|
|
|
if globals.getManifest() is None and bpy.app.online_access:
|
|
try:
|
|
globals.fetchAndSaveManifest()
|
|
except Exception as e:
|
|
print(f"D2Toolbox: failed to fetch manifest on load: {e}")
|
|
|
|
def unregister():
|
|
del bpy.types.Scene.d2toolbox
|
|
|
|
for cls in reversed(classes):
|
|
bpy.utils.unregister_class(cls)
|
|
|
|
if __name__ == "__main__":
|
|
register()
|