f3c23c1f202f25bca9031200465c9afdacfc349e
[blender.git] / source / blender / editors / armature / armature_ops.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version. 
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2009 Blender Foundation.
19  * All rights reserved.
20  *
21  * 
22  * Contributor(s): Blender Foundation
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 /** \file blender/editors/armature/armature_ops.c
28  *  \ingroup edarmature
29  */
30
31 #include "BLI_math.h"
32
33 #include "RNA_access.h"
34
35 #include "WM_api.h"
36 #include "WM_types.h"
37
38 #include "ED_armature.h"
39 #include "ED_screen.h"
40 #include "ED_transform.h"
41
42 #include "armature_intern.h"
43
44 /* ************************** registration **********************************/
45
46 /* Both operators ARMATURE_OT_xxx and POSE_OT_xxx here */
47 void ED_operatortypes_armature(void)
48 {
49         /* EDIT ARMATURE */
50         WM_operatortype_append(ARMATURE_OT_bone_primitive_add);
51         
52         WM_operatortype_append(ARMATURE_OT_align);
53         WM_operatortype_append(ARMATURE_OT_calculate_roll);
54         WM_operatortype_append(ARMATURE_OT_switch_direction);
55         WM_operatortype_append(ARMATURE_OT_subdivide);
56         
57         WM_operatortype_append(ARMATURE_OT_parent_set);
58         WM_operatortype_append(ARMATURE_OT_parent_clear);
59         
60         WM_operatortype_append(ARMATURE_OT_select_all);
61         WM_operatortype_append(ARMATURE_OT_select_mirror);
62         WM_operatortype_append(ARMATURE_OT_select_more);
63         WM_operatortype_append(ARMATURE_OT_select_less);
64         WM_operatortype_append(ARMATURE_OT_select_hierarchy);
65         WM_operatortype_append(ARMATURE_OT_select_linked);
66         WM_operatortype_append(ARMATURE_OT_select_similar);
67         WM_operatortype_append(ARMATURE_OT_shortest_path_pick);
68
69         WM_operatortype_append(ARMATURE_OT_delete);
70         WM_operatortype_append(ARMATURE_OT_duplicate);
71         WM_operatortype_append(ARMATURE_OT_extrude);
72         WM_operatortype_append(ARMATURE_OT_hide);
73         WM_operatortype_append(ARMATURE_OT_reveal);
74         WM_operatortype_append(ARMATURE_OT_click_extrude);
75         WM_operatortype_append(ARMATURE_OT_fill);
76         WM_operatortype_append(ARMATURE_OT_merge);
77         WM_operatortype_append(ARMATURE_OT_separate);
78         WM_operatortype_append(ARMATURE_OT_split);
79         
80         WM_operatortype_append(ARMATURE_OT_autoside_names);
81         WM_operatortype_append(ARMATURE_OT_flip_names);
82         
83         WM_operatortype_append(ARMATURE_OT_layers_show_all);
84         WM_operatortype_append(ARMATURE_OT_armature_layers);
85         WM_operatortype_append(ARMATURE_OT_bone_layers);
86
87         /* SKETCH */
88         WM_operatortype_append(SKETCH_OT_gesture);
89         WM_operatortype_append(SKETCH_OT_delete);
90         WM_operatortype_append(SKETCH_OT_draw_stroke);
91         WM_operatortype_append(SKETCH_OT_draw_preview);
92         WM_operatortype_append(SKETCH_OT_finish_stroke);
93         WM_operatortype_append(SKETCH_OT_cancel_stroke);
94         WM_operatortype_append(SKETCH_OT_convert);
95         WM_operatortype_append(SKETCH_OT_select);
96
97         /* POSE */
98         WM_operatortype_append(POSE_OT_hide);
99         WM_operatortype_append(POSE_OT_reveal);
100         
101         WM_operatortype_append(POSE_OT_armature_apply);
102         WM_operatortype_append(POSE_OT_visual_transform_apply);
103         
104         WM_operatortype_append(POSE_OT_rot_clear);
105         WM_operatortype_append(POSE_OT_loc_clear);
106         WM_operatortype_append(POSE_OT_scale_clear);
107         WM_operatortype_append(POSE_OT_transforms_clear);
108         WM_operatortype_append(POSE_OT_user_transforms_clear);
109         
110         WM_operatortype_append(POSE_OT_copy);
111         WM_operatortype_append(POSE_OT_paste);
112         
113         WM_operatortype_append(POSE_OT_select_all);
114
115         WM_operatortype_append(POSE_OT_select_parent);
116         WM_operatortype_append(POSE_OT_select_hierarchy);
117         WM_operatortype_append(POSE_OT_select_linked);
118         WM_operatortype_append(POSE_OT_select_constraint_target);
119         WM_operatortype_append(POSE_OT_select_grouped);
120         WM_operatortype_append(POSE_OT_select_mirror);
121         
122         WM_operatortype_append(POSE_OT_group_add);
123         WM_operatortype_append(POSE_OT_group_remove);
124         WM_operatortype_append(POSE_OT_group_move);
125         WM_operatortype_append(POSE_OT_group_sort);
126         WM_operatortype_append(POSE_OT_group_assign);
127         WM_operatortype_append(POSE_OT_group_unassign);
128         WM_operatortype_append(POSE_OT_group_select);
129         WM_operatortype_append(POSE_OT_group_deselect);
130         
131         WM_operatortype_append(POSE_OT_paths_calculate);
132         WM_operatortype_append(POSE_OT_paths_update);
133         WM_operatortype_append(POSE_OT_paths_clear);
134         
135         WM_operatortype_append(POSE_OT_autoside_names);
136         WM_operatortype_append(POSE_OT_flip_names);
137         
138         WM_operatortype_append(POSE_OT_rotation_mode_set);
139
140         WM_operatortype_append(POSE_OT_quaternions_flip);
141         
142         WM_operatortype_append(POSE_OT_armature_layers);
143         WM_operatortype_append(POSE_OT_bone_layers);
144         
145         WM_operatortype_append(POSE_OT_propagate);
146         
147         /* POSELIB */
148         WM_operatortype_append(POSELIB_OT_browse_interactive);
149         WM_operatortype_append(POSELIB_OT_apply_pose);
150         
151         WM_operatortype_append(POSELIB_OT_pose_add);
152         WM_operatortype_append(POSELIB_OT_pose_remove);
153         WM_operatortype_append(POSELIB_OT_pose_rename);
154         
155         WM_operatortype_append(POSELIB_OT_new);
156         WM_operatortype_append(POSELIB_OT_unlink);
157         
158         WM_operatortype_append(POSELIB_OT_action_sanitize);
159         
160         /* POSE SLIDING */
161         WM_operatortype_append(POSE_OT_push);
162         WM_operatortype_append(POSE_OT_relax);
163         WM_operatortype_append(POSE_OT_breakdown);
164 }
165
166 void ED_operatormacros_armature(void)
167 {
168         wmOperatorType *ot;
169         wmOperatorTypeMacro *otmacro;
170
171         ot = WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate",
172                                           "Make copies of the selected bones within the same armature and move them",
173                                           OPTYPE_UNDO | OPTYPE_REGISTER);
174         WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
175         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
176         RNA_enum_set(otmacro->ptr, "proportional", 0);
177
178         ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude",
179                                           "Create new bones from the selected joints and move them",
180                                           OPTYPE_UNDO | OPTYPE_REGISTER);
181         otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
182         RNA_boolean_set(otmacro->ptr, "forked", false);
183         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
184         RNA_enum_set(otmacro->ptr, "proportional", 0);
185
186         /* XXX would it be nicer to just be able to have standard extrude_move, but set the forked property separate?
187          * that would require fixing a properties bug 19733 */
188         ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked",
189                                           "Create new bones from the selected joints and move them",
190                                           OPTYPE_UNDO | OPTYPE_REGISTER);
191         otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
192         RNA_boolean_set(otmacro->ptr, "forked", true);
193         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
194         RNA_enum_set(otmacro->ptr, "proportional", 0);
195 }
196
197 void ED_keymap_armature(wmKeyConfig *keyconf)
198 {
199         wmKeyMap *keymap;
200         wmKeyMapItem *kmi;
201         
202         /* Armature ------------------------ */
203         keymap = WM_keymap_find(keyconf, "Armature", 0, 0);
204         keymap->poll = ED_operator_editarmature;
205         
206         /* Armature -> Etch-A-Ton ------------------------ */
207         WM_keymap_add_item(keymap, "SKETCH_OT_delete", XKEY, KM_PRESS, 0, 0);
208         WM_keymap_add_item(keymap, "SKETCH_OT_delete", DELKEY, KM_PRESS, 0, 0);
209         WM_keymap_add_item(keymap, "SKETCH_OT_finish_stroke", RIGHTMOUSE, KM_PRESS, 0, 0);
210         WM_keymap_add_item(keymap, "SKETCH_OT_cancel_stroke", ESCKEY, KM_PRESS, 0, 0);
211         /* Already part of view3d select */
212         //WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
213
214         /* sketch poll checks mode */
215         WM_keymap_add_item(keymap, "SKETCH_OT_gesture", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
216         WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, 0, 0);
217         kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
218         RNA_boolean_set(kmi->ptr, "snap", true);
219         WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, 0, 0);
220         kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, KM_CTRL, 0);
221         RNA_boolean_set(kmi->ptr, "snap", true);
222
223         /* only set in editmode armature, by space_view3d listener */
224         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, 0, 0);
225         RNA_boolean_set(kmi->ptr, "unselected", false);
226         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
227         RNA_boolean_set(kmi->ptr, "unselected", true);
228
229         WM_keymap_add_item(keymap, "ARMATURE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
230         WM_keymap_add_item(keymap, "ARMATURE_OT_align", AKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
231         WM_keymap_add_item(keymap, "ARMATURE_OT_calculate_roll", NKEY, KM_PRESS, KM_CTRL, 0);
232         
233         WM_keymap_add_item(keymap, "ARMATURE_OT_switch_direction", FKEY, KM_PRESS, KM_ALT, 0);
234         
235         WM_keymap_add_item(keymap, "ARMATURE_OT_bone_primitive_add", AKEY, KM_PRESS, KM_SHIFT, 0);
236         
237         WM_keymap_add_item(keymap, "ARMATURE_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
238         WM_keymap_add_item(keymap, "ARMATURE_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
239         
240         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", AKEY, KM_PRESS, 0, 0);
241         RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
242         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
243         RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
244
245         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
246         RNA_boolean_set(kmi->ptr, "extend", false);
247         
248         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
249         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
250         RNA_boolean_set(kmi->ptr, "extend", false);
251         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
252         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
253         RNA_boolean_set(kmi->ptr, "extend", true);
254         
255         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
256         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
257         RNA_boolean_set(kmi->ptr, "extend", false);
258         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
259         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
260         RNA_boolean_set(kmi->ptr, "extend", true);
261
262         WM_keymap_add_item(keymap, "ARMATURE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
263         WM_keymap_add_item(keymap, "ARMATURE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
264
265         WM_keymap_add_item(keymap, "ARMATURE_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
266
267         WM_keymap_add_item(keymap, "ARMATURE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
268
269         WM_keymap_add_item(keymap, "ARMATURE_OT_shortest_path_pick", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
270         
271         WM_keymap_add_item(keymap, "ARMATURE_OT_delete", XKEY, KM_PRESS, 0, 0);
272         WM_keymap_add_item(keymap, "ARMATURE_OT_delete", DELKEY, KM_PRESS, 0, 0);
273         WM_keymap_add_item(keymap, "ARMATURE_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
274         WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_move", EKEY, KM_PRESS, 0, 0);
275         WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_forked", EKEY, KM_PRESS, KM_SHIFT, 0);
276         WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
277         WM_keymap_add_item(keymap, "ARMATURE_OT_fill", FKEY, KM_PRESS, 0, 0);
278         WM_keymap_add_item(keymap, "ARMATURE_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
279         WM_keymap_add_item(keymap, "ARMATURE_OT_split", YKEY, KM_PRESS, 0, 0);
280         
281         WM_keymap_add_item(keymap, "ARMATURE_OT_separate", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
282         
283         /* set flags */
284         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
285         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
286         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
287                 
288         /* armature/bone layers */
289         WM_keymap_add_item(keymap, "ARMATURE_OT_layers_show_all", ACCENTGRAVEKEY, KM_PRESS, KM_CTRL, 0);
290         WM_keymap_add_item(keymap, "ARMATURE_OT_armature_layers", MKEY, KM_PRESS, KM_SHIFT, 0);
291         WM_keymap_add_item(keymap, "ARMATURE_OT_bone_layers", MKEY, KM_PRESS, 0, 0);
292         
293         /* special transforms: */
294         /*  1) envelope/b-bone size */
295         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
296         RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
297         /*  2) envelope radius */
298         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0);
299         RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ENVELOPE);
300         /*  3) set roll */
301         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0);
302         RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ROLL);
303                 
304         /* menus */
305         WM_keymap_add_menu(keymap, "VIEW3D_MT_armature_specials", WKEY, KM_PRESS, 0, 0);
306
307         /* Pose ------------------------ */
308         /* only set in posemode, by space_view3d listener */
309         keymap = WM_keymap_find(keyconf, "Pose", 0, 0);
310         keymap->poll = ED_operator_posemode;
311         
312         /* set parent and add object are object-based operators, but we make them
313          * available here because it's useful to do in pose mode too */
314         WM_keymap_add_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
315         WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
316         
317         kmi = WM_keymap_add_item(keymap, "POSE_OT_hide", HKEY, KM_PRESS, 0, 0);
318         RNA_boolean_set(kmi->ptr, "unselected", false);
319         kmi = WM_keymap_add_item(keymap, "POSE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
320         RNA_boolean_set(kmi->ptr, "unselected", true);
321
322         WM_keymap_add_item(keymap, "POSE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
323         
324         WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_apply", AKEY, KM_PRESS, KM_CTRL, 0);
325         
326         /* TODO: clear pose */
327         WM_keymap_add_item(keymap, "POSE_OT_rot_clear", RKEY, KM_PRESS, KM_ALT, 0);
328         WM_keymap_add_item(keymap, "POSE_OT_loc_clear", GKEY, KM_PRESS, KM_ALT, 0);
329         WM_keymap_add_item(keymap, "POSE_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0);
330         
331         WM_keymap_add_item(keymap, "POSE_OT_quaternions_flip", FKEY, KM_PRESS, KM_ALT, 0);
332         
333         WM_keymap_add_item(keymap, "POSE_OT_rotation_mode_set", RKEY, KM_PRESS, KM_CTRL, 0);
334         
335         WM_keymap_add_item(keymap, "POSE_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
336         kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
337         RNA_boolean_set(kmi->ptr, "flipped", false);
338         kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
339         RNA_boolean_set(kmi->ptr, "flipped", true);
340         
341 #ifdef __APPLE__
342         WM_keymap_add_item(keymap, "POSE_OT_copy", CKEY, KM_PRESS, KM_OSKEY, 0);
343         kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_OSKEY, 0);
344         RNA_boolean_set(kmi->ptr, "flipped", false);
345         kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_OSKEY | KM_SHIFT, 0);
346         RNA_boolean_set(kmi->ptr, "flipped", true);
347 #endif
348
349         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", AKEY, KM_PRESS, 0, 0);
350         RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
351         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
352         RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
353
354         WM_keymap_add_item(keymap, "POSE_OT_select_parent", PKEY, KM_PRESS, KM_SHIFT, 0);
355
356         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
357         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
358         RNA_boolean_set(kmi->ptr, "extend", false);
359         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
360         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
361         RNA_boolean_set(kmi->ptr, "extend", true);
362         
363         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
364         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
365         RNA_boolean_set(kmi->ptr, "extend", false);
366         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
367         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
368         RNA_boolean_set(kmi->ptr, "extend", true);
369
370         WM_keymap_add_item(keymap, "POSE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
371         WM_keymap_add_item(keymap, "POSE_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
372         WM_keymap_add_item(keymap, "POSE_OT_select_mirror", FKEY, KM_PRESS, KM_SHIFT, 0);
373         
374         WM_keymap_add_item(keymap, "POSE_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
375         WM_keymap_add_item(keymap, "POSE_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
376         WM_keymap_add_item(keymap, "POSE_OT_ik_add", IKEY, KM_PRESS, /*KM_CTRL|*/ KM_SHIFT, 0);
377         WM_keymap_add_item(keymap, "POSE_OT_ik_clear", IKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
378         
379         WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_group", GKEY, KM_PRESS, KM_CTRL, 0);
380         
381         /* set flags */
382         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
383         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
384         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
385
386         /* armature/bone layers */
387         WM_keymap_add_item(keymap, "ARMATURE_OT_layers_show_all", ACCENTGRAVEKEY, KM_PRESS, KM_CTRL, 0);
388         WM_keymap_add_item(keymap, "POSE_OT_armature_layers", MKEY, KM_PRESS, KM_SHIFT, 0);
389         WM_keymap_add_item(keymap, "POSE_OT_bone_layers", MKEY, KM_PRESS, 0, 0);
390         
391         /* special transforms: */
392         /*  1) envelope/b-bone size */
393         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
394         RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
395         
396         /* keyframes management */
397         WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0);
398         WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete_v3d", IKEY, KM_PRESS, KM_ALT, 0);
399         WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL | KM_SHIFT | KM_ALT, 0);
400         
401         /* Pose -> PoseLib ------------- */
402         /* only set in posemode, by space_view3d listener */
403         WM_keymap_add_item(keymap, "POSELIB_OT_browse_interactive", LKEY, KM_PRESS, KM_CTRL, 0);
404         
405         WM_keymap_add_item(keymap, "POSELIB_OT_pose_add", LKEY, KM_PRESS, KM_SHIFT, 0);
406         WM_keymap_add_item(keymap, "POSELIB_OT_pose_remove", LKEY, KM_PRESS, KM_ALT, 0);
407         WM_keymap_add_item(keymap, "POSELIB_OT_pose_rename", LKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
408         
409         /* Pose -> Pose Sliding ------------- */
410         /* only set in posemode, by space_view3d listener */
411         WM_keymap_add_item(keymap, "POSE_OT_push", EKEY, KM_PRESS, KM_CTRL, 0);
412         WM_keymap_add_item(keymap, "POSE_OT_relax", EKEY, KM_PRESS, KM_ALT, 0);
413         WM_keymap_add_item(keymap, "POSE_OT_breakdown", EKEY, KM_PRESS, KM_SHIFT, 0);
414
415         /* menus */
416         WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_specials", WKEY, KM_PRESS, 0, 0);
417 }
418