86 lines
2.2 KiB
Python
86 lines
2.2 KiB
Python
import sys
|
|
|
|
# Reload support: drop our cached submodules so "Reload Scripts" and
|
|
# disable/enable pick up edits in every file, not only this one.
|
|
for _name in [name for name in sys.modules if name.startswith(__name__ + ".")]:
|
|
del sys.modules[_name]
|
|
|
|
import bpy # noqa: E402
|
|
from bpy.app.handlers import persistent # noqa: E402
|
|
|
|
from . import checks, core, rename, shot_viewer, tools_ops, ui # noqa: E402
|
|
from .core import runner # noqa: E402
|
|
|
|
api = core
|
|
|
|
# Old bl_info to be able to develop on live code
|
|
bl_info = {
|
|
"name": "Melvile Tools",
|
|
"author": "Walking The Dog (WTD)",
|
|
"version": (0, 1, 1),
|
|
"blender": (5, 2, 0),
|
|
"description": "Tools for the Melvile Pipeline",
|
|
"location": "",
|
|
"warning": "",
|
|
"wiki_url": "",
|
|
"tracker_url": "",
|
|
"category": [],
|
|
}
|
|
|
|
|
|
@persistent
|
|
def _on_load_post(*_args):
|
|
runner.clear()
|
|
|
|
|
|
def _load_config_override():
|
|
prefs = ui.properties.get_prefs()
|
|
ui.properties.load_config_override(prefs.config_path if prefs else "")
|
|
|
|
|
|
# Register modules
|
|
def register() -> None:
|
|
# Register tool operators
|
|
tools_ops.register()
|
|
|
|
# Register the rename tool (settings and operator, before its panel)
|
|
rename.register()
|
|
|
|
# Register the shot viewer (settings and operators, before its panel)
|
|
shot_viewer.register()
|
|
|
|
# Load all the sanity checks into the sanity REGISTRY
|
|
checks.load_all()
|
|
|
|
# Register the UI for all panels
|
|
ui.register()
|
|
|
|
# Load the configuration for sanity checks
|
|
_load_config_override()
|
|
|
|
# Load it natively
|
|
bpy.app.handlers.load_post.append(_on_load_post)
|
|
|
|
|
|
# Unregister modules
|
|
def unregister() -> None:
|
|
# Unregister tool operators
|
|
tools_ops.unregister()
|
|
|
|
# Destroy the post loader
|
|
if _on_load_post in bpy.app.handlers.load_post:
|
|
bpy.app.handlers.load_post.remove(_on_load_post)
|
|
|
|
# Unregister all panels
|
|
ui.unregister()
|
|
|
|
# Unregister the rename tool (after its panel)
|
|
rename.unregister()
|
|
|
|
# Unregister the shot viewer (after its panel)
|
|
shot_viewer.unregister()
|
|
|
|
runner.clear()
|
|
# The check registry is plain Python and is rebuilt with the modules on
|
|
# re-import, so it is kept as is (enable/disable without re-import).
|