forked from aresdevo/animaide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
executable file
·169 lines (117 loc) · 5.33 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import bpy
# licence
'''
Copyright (C) 2018 Ares Deveaux
Created by Ares Deveaux
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
# Addon Info
bl_info = {
"name": "AnimAide",
"description": "",
"author": "Ares Deveaux",
"version": (0, 2, 0),
"blender": (2, 80, 0),
"location": "Graph Editor > Sidebar",
"warning": "This addon is still in development.",
"category": "Animation",
"wiki_url": "https://github.com/aresdevo/animaide",
"tracker_url": "https://github.com/aresdevo/animaide/issues"
}
# load and reload submodules
#################################
from . import utils, key_utils, cur_utils, magnet, props, ops, ui
classes = props.classes + ops.classes + ui.classes
# register
##################################
# store keymaps here to access after registration
addon_keymaps = []
def register_keymaps():
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
km = wm.keyconfigs.addon.keymaps.new(name='Window', space_type='EMPTY')
kmi = km.keymap_items.new('wm.call_menu_pie', 'ONE', 'PRESS', alt=True)
kmi.properties.name = 'AAT_MT_pie_menu_a'
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('wm.call_menu_pie', 'TWO', 'PRESS', alt=True)
kmi.properties.name = 'AAT_MT_pie_menu_b'
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.ease_to_ease', 'ONE', 'PRESS')
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.tween', 'ONE', 'PRESS', shift=True)
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.ease', 'TWO', 'PRESS')
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.blend_ease', 'TWO', 'PRESS', shift=True)
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.blend_neighbor', 'THREE', 'PRESS')
kmi.properties.op_context = 'INVOKE_DEFAULT'
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.blend_neighbor', 'MINUS', 'PRESS')
kmi.properties.op_context = 'EXEC_DEFAULT'
kmi.properties.factor = -0.15
# kmi.properties.slope = 1
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.blend_neighbor', 'EQUAL', 'PRESS')
kmi.properties.op_context = 'EXEC_DEFAULT'
kmi.properties.factor = 0.15
# kmi.properties.slope = 1
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.blend_neighbor', 'MINUS', 'PRESS')
kmi.shift = True
kmi.properties.op_context = 'EXEC_DEFAULT'
kmi.properties.factor = -1
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.blend_neighbor', 'EQUAL', 'PRESS')
kmi.shift = True
kmi.properties.op_context = 'EXEC_DEFAULT'
kmi.properties.factor = 1
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.blend_frame', 'THREE', 'PRESS', shift=True)
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.push_pull', 'FOUR', 'PRESS')
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.scale_average', 'FOUR', 'PRESS', shift=True)
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.scale_left', 'FIVE', 'PRESS')
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.scale_right', 'FIVE', 'PRESS', shift=True)
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.smooth', 'SIX', 'PRESS')
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.noise', 'SIX', 'PRESS', shift=True)
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.time_offset', 'SEVEN', 'PRESS')
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('animaide.blend_offset', 'SEVEN', 'PRESS', shift=True)
addon_keymaps.append((km, kmi))
def unregister_keymaps():
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
def register():
for cls in classes:
bpy.utils.register_class(cls)
props.set_props()
register_keymaps()
def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
props.del_props()
if magnet.anim_transform_handlers in bpy.app.handlers.depsgraph_update_pre:
bpy.app.handlers.depsgraph_update_pre.remove(magnet.anim_transform_handlers)
if magnet.anim_trans_mask_handlers in bpy.app.handlers.depsgraph_update_pre:
bpy.app.handlers.depsgraph_update_pre.remove(magnet.anim_trans_mask_handlers)
unregister_keymaps()