-
Notifications
You must be signed in to change notification settings - Fork 48
/
__init__.py
68 lines (54 loc) · 1.47 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
bl_info = {
'name' : 'Animation Retargeting',
'author' : 'Mwni',
'description' : 'Retarget animations from one armature to another',
'version': (2, 3, 0),
'blender' : (3, 0, 0),
'location' : '3D View > Tools (Right Side) > Retargeting',
'category' : 'Animation',
'wiki_url': 'https://github.com/Mwni/blender-animation-retargeting',
'tracker_url': 'https://github.com/Mwni/blender-animation-retargeting/issues',
}
import bpy
from . import context
from . import main
from . import mapping
from . import alignment
from . import corrections
from . import baking
from . import drivers
from . import ik
from . import savefile
from importlib import reload
modules = [
context,
main,
mapping,
alignment,
corrections,
baking,
drivers,
ik,
savefile,
]
def register():
for i, module in enumerate(modules):
modules[i] = reload(module)
for module in modules:
for cls in module.classes:
bpy.utils.register_class(cls)
bpy.types.Object.retargeting_context = bpy.props.PointerProperty(type=modules[0].Context)
bpy.app.handlers.load_post.append(post_load)
def unregister():
for module in modules:
for cls in module.classes:
bpy.utils.unregister_class(cls)
del bpy.types.Object.retargeting_context
if post_load in bpy.app.handlers.load_post:
bpy.app.handlers.load_post.remove(post_load)
@bpy.app.handlers.persistent
def post_load(_):
from .drivers import update_drivers
for obj in bpy.data.objects:
if obj.type == 'ARMATURE':
update_drivers(obj.retargeting_context)