/
__init__.py
79 lines (58 loc) · 1.99 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
bl_info = {
"name": "VrmHumanoid",
"blender": (4, 1, 0),
"category": "Rigging",
"description": "Create vrm compliant humanoid armarture and copy humanoid pose to clipboard as UNIVRM_pose",
"author": "ousttrue",
"version": (3, 1, 0),
"wiki_url": "https://github.com/ousttrue/humanoid",
}
import bpy
import importlib
if "humanoid_utils" in locals():
importlib.reload(humanoid_utils)
if "humanoid_properties" in locals():
importlib.reload(humanoid_properties)
if "create_humanoid" in locals():
importlib.reload(create_humanoid)
if "add_humanoid_rig" in locals():
importlib.reload(add_humanoid_rig)
if "copy_humanoid_pose" in locals():
importlib.reload(copy_humanoid_pose)
if "guess_human_bones" in locals():
importlib.reload(guess_human_bones)
if "humanoid_panel" in locals():
importlib.reload(humanoid_panel)
from . import humanoid_utils
from .humanoid_properties import HumanoidProperties
from .create_humanoid import CreateHumanoid
from .add_humanoid_rig import AddHumanoidRig
from .copy_humanoid_pose import CopyHumanoidPose
from .guess_human_bones import GuessHumanBones
from .humanoid_panel import ArmatureHumanoidPanel, SelectPoseBone
OPERATORS = [
CreateHumanoid,
AddHumanoidRig,
CopyHumanoidPose,
GuessHumanBones,
SelectPoseBone,
]
CLASSES = [HumanoidProperties, ArmatureHumanoidPanel] + OPERATORS
def add_to_menu(menu: str, op):
def menu_func(self, context):
if hasattr(op, "bl_icon"):
self.layout.operator(op.bl_idname, icon=op.bl_icon)
else:
self.layout.operator(op.bl_idname)
getattr(bpy.types, menu).prepend(menu_func)
def register():
for cls in CLASSES:
bpy.utils.register_class(cls)
if hasattr(cls, "bl_menu"):
add_to_menu(cls.bl_menu, cls)
bpy.types.Armature.humanoid = bpy.props.PointerProperty(type=HumanoidProperties)
def unregister():
for cls in CLASSES:
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()