Files
blender-portable-repo/scripts/addons/pose_shape_keys/__init__.py
T
2026-03-17 14:58:51 -06:00

68 lines
2.0 KiB
Python

# SPDX-FileCopyrightText: 2025 Blender Studio Tools Authors
#
# SPDX-License-Identifier: GPL-3.0-or-later
bl_info = {
"name": "Pose Shape Keys",
"author": "Demeter Dzadik",
"version": (1, 0, 0),
"blender": (3, 1, 0),
"location": "Properties -> Mesh Data -> Shape Keys -> Pose Keys",
"description": "Create shape keys that blend deformed meshes into a desired shape",
"category": "Rigging",
"doc_url": "https://studio.blender.org/tools/addons/pose_shape_keys",
"tracker_url": "https://projects.blender.org/studio/blender-studio-tools/src/branch/main/scripts-blender/addons/pose_shape_keys",
}
import importlib
import bpy
from . import (
props,
prefs,
ui,
ops,
ui_list,
symmetrize_shape_key,
naming,
)
# Each module can have register() and unregister() functions and a list of classes to register called "registry".
modules = [props, prefs, ui, ops, ui_list, symmetrize_shape_key, naming]
def register_unregister_modules(modules, register: bool):
"""Recursively register or unregister modules by looking for either
un/register() functions or lists named `registry` which should be a list of
registerable classes.
"""
register_func = bpy.utils.register_class if register else bpy.utils.unregister_class
for m in modules:
if register:
importlib.reload(m)
if hasattr(m, 'registry'):
for c in m.registry:
try:
register_func(c)
except Exception as e:
un = 'un' if not register else ''
print(f"Warning: Failed to {un}register class: {c.__name__}")
print(e)
if hasattr(m, 'modules'):
register_unregister_modules(m.modules, register)
if register and hasattr(m, 'register'):
m.register()
elif hasattr(m, 'unregister'):
m.unregister()
def register():
register_unregister_modules(modules, register=True)
def unregister():
register_unregister_modules(modules, register=False)