Fix T39895: Displaying the armature layers popup in edit mode always fails.
[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_bone_layers);
143         
144         WM_operatortype_append(POSE_OT_propagate);
145         
146         /* POSELIB */
147         WM_operatortype_append(POSELIB_OT_browse_interactive);
148         WM_operatortype_append(POSELIB_OT_apply_pose);
149         
150         WM_operatortype_append(POSELIB_OT_pose_add);
151         WM_operatortype_append(POSELIB_OT_pose_remove);
152         WM_operatortype_append(POSELIB_OT_pose_rename);
153         
154         WM_operatortype_append(POSELIB_OT_new);
155         WM_operatortype_append(POSELIB_OT_unlink);
156         
157         WM_operatortype_append(POSELIB_OT_action_sanitize);
158         
159         /* POSE SLIDING */
160         WM_operatortype_append(POSE_OT_push);
161         WM_operatortype_append(POSE_OT_relax);
162         WM_operatortype_append(POSE_OT_breakdown);
163 }
164
165 void ED_operatormacros_armature(void)
166 {
167         wmOperatorType *ot;
168         wmOperatorTypeMacro *otmacro;
169
170         ot = WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate",
171                                           "Make copies of the selected bones within the same armature and move them",
172                                           OPTYPE_UNDO | OPTYPE_REGISTER);
173         WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
174         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
175         RNA_enum_set(otmacro->ptr, "proportional", 0);
176
177         ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude",
178                                           "Create new bones from the selected joints and move them",
179                                           OPTYPE_UNDO | OPTYPE_REGISTER);
180         otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
181         RNA_boolean_set(otmacro->ptr, "forked", false);
182         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
183         RNA_enum_set(otmacro->ptr, "proportional", 0);
184
185         /* XXX would it be nicer to just be able to have standard extrude_move, but set the forked property separate?
186          * that would require fixing a properties bug 19733 */
187         ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked",
188                                           "Create new bones from the selected joints and move them",
189                                           OPTYPE_UNDO | OPTYPE_REGISTER);
190         otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
191         RNA_boolean_set(otmacro->ptr, "forked", true);
192         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
193         RNA_enum_set(otmacro->ptr, "proportional", 0);
194 }
195
196 void ED_keymap_armature(wmKeyConfig *keyconf)
197 {
198         wmKeyMap *keymap;
199         wmKeyMapItem *kmi;
200         
201         /* Armature ------------------------ */
202         keymap = WM_keymap_find(keyconf, "Armature", 0, 0);
203         keymap->poll = ED_operator_editarmature;
204         
205         /* Armature -> Etch-A-Ton ------------------------ */
206         WM_keymap_add_item(keymap, "SKETCH_OT_delete", XKEY, KM_PRESS, 0, 0);
207         WM_keymap_add_item(keymap, "SKETCH_OT_delete", DELKEY, KM_PRESS, 0, 0);
208         WM_keymap_add_item(keymap, "SKETCH_OT_finish_stroke", RIGHTMOUSE, KM_PRESS, 0, 0);
209         WM_keymap_add_item(keymap, "SKETCH_OT_cancel_stroke", ESCKEY, KM_PRESS, 0, 0);
210         /* Already part of view3d select */
211         //WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
212
213         /* sketch poll checks mode */
214         WM_keymap_add_item(keymap, "SKETCH_OT_gesture", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
215         WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, 0, 0);
216         kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
217         RNA_boolean_set(kmi->ptr, "snap", true);
218         WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, 0, 0);
219         kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, KM_CTRL, 0);
220         RNA_boolean_set(kmi->ptr, "snap", true);
221
222         /* only set in editmode armature, by space_view3d listener */
223         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, 0, 0);
224         RNA_boolean_set(kmi->ptr, "unselected", false);
225         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
226         RNA_boolean_set(kmi->ptr, "unselected", true);
227
228         WM_keymap_add_item(keymap, "ARMATURE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
229         WM_keymap_add_item(keymap, "ARMATURE_OT_align", AKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
230         WM_keymap_add_item(keymap, "ARMATURE_OT_calculate_roll", NKEY, KM_PRESS, KM_CTRL, 0);
231         
232         WM_keymap_add_item(keymap, "ARMATURE_OT_switch_direction", FKEY, KM_PRESS, KM_ALT, 0);
233         
234         WM_keymap_add_item(keymap, "ARMATURE_OT_bone_primitive_add", AKEY, KM_PRESS, KM_SHIFT, 0);
235         
236         WM_keymap_add_item(keymap, "ARMATURE_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
237         WM_keymap_add_item(keymap, "ARMATURE_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
238         
239         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", AKEY, KM_PRESS, 0, 0);
240         RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
241         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
242         RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
243
244         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
245         RNA_boolean_set(kmi->ptr, "extend", false);
246         
247         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
248         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
249         RNA_boolean_set(kmi->ptr, "extend", false);
250         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
251         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
252         RNA_boolean_set(kmi->ptr, "extend", true);
253         
254         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
255         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
256         RNA_boolean_set(kmi->ptr, "extend", false);
257         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
258         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
259         RNA_boolean_set(kmi->ptr, "extend", true);
260
261         WM_keymap_add_item(keymap, "ARMATURE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
262         WM_keymap_add_item(keymap, "ARMATURE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
263
264         WM_keymap_add_item(keymap, "ARMATURE_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
265
266         WM_keymap_add_item(keymap, "ARMATURE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
267
268         WM_keymap_add_item(keymap, "ARMATURE_OT_shortest_path_pick", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
269         
270         WM_keymap_add_item(keymap, "ARMATURE_OT_delete", XKEY, KM_PRESS, 0, 0);
271         WM_keymap_add_item(keymap, "ARMATURE_OT_delete", DELKEY, KM_PRESS, 0, 0);
272         WM_keymap_add_item(keymap, "ARMATURE_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
273         WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_move", EKEY, KM_PRESS, 0, 0);
274         WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_forked", EKEY, KM_PRESS, KM_SHIFT, 0);
275         WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
276         WM_keymap_add_item(keymap, "ARMATURE_OT_fill", FKEY, KM_PRESS, 0, 0);
277         WM_keymap_add_item(keymap, "ARMATURE_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
278         WM_keymap_add_item(keymap, "ARMATURE_OT_split", YKEY, KM_PRESS, 0, 0);
279         
280         WM_keymap_add_item(keymap, "ARMATURE_OT_separate", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
281         
282         /* set flags */
283         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
284         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
285         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
286         
287         /* armature/bone layers */
288         WM_keymap_add_item(keymap, "ARMATURE_OT_layers_show_all", ACCENTGRAVEKEY, KM_PRESS, KM_CTRL, 0);
289         WM_keymap_add_item(keymap, "ARMATURE_OT_armature_layers", MKEY, KM_PRESS, KM_SHIFT, 0);
290         WM_keymap_add_item(keymap, "ARMATURE_OT_bone_layers", MKEY, KM_PRESS, 0, 0);
291         
292         /* special transforms: */
293         /*  1) envelope/b-bone size */
294         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
295         RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
296         /*  2) envelope radius */
297         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0);
298         RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ENVELOPE);
299         /*  3) set roll */
300         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0);
301         RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ROLL);
302                 
303         /* menus */
304         WM_keymap_add_menu(keymap, "VIEW3D_MT_armature_specials", WKEY, KM_PRESS, 0, 0);
305
306         /* Pose ------------------------ */
307         /* only set in posemode, by space_view3d listener */
308         keymap = WM_keymap_find(keyconf, "Pose", 0, 0);
309         keymap->poll = ED_operator_posemode;
310         
311         /* set parent and add object are object-based operators, but we make them
312          * available here because it's useful to do in pose mode too */
313         WM_keymap_add_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
314         WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
315         
316         kmi = WM_keymap_add_item(keymap, "POSE_OT_hide", HKEY, KM_PRESS, 0, 0);
317         RNA_boolean_set(kmi->ptr, "unselected", false);
318         kmi = WM_keymap_add_item(keymap, "POSE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
319         RNA_boolean_set(kmi->ptr, "unselected", true);
320
321         WM_keymap_add_item(keymap, "POSE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
322         
323         WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_apply", AKEY, KM_PRESS, KM_CTRL, 0);
324         
325         /* TODO: clear pose */
326         WM_keymap_add_item(keymap, "POSE_OT_rot_clear", RKEY, KM_PRESS, KM_ALT, 0);
327         WM_keymap_add_item(keymap, "POSE_OT_loc_clear", GKEY, KM_PRESS, KM_ALT, 0);
328         WM_keymap_add_item(keymap, "POSE_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0);
329         
330         WM_keymap_add_item(keymap, "POSE_OT_quaternions_flip", FKEY, KM_PRESS, KM_ALT, 0);
331         
332         WM_keymap_add_item(keymap, "POSE_OT_rotation_mode_set", RKEY, KM_PRESS, KM_CTRL, 0);
333         
334         WM_keymap_add_item(keymap, "POSE_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
335         kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
336         RNA_boolean_set(kmi->ptr, "flipped", false);
337         kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
338         RNA_boolean_set(kmi->ptr, "flipped", true);
339         
340 #ifdef __APPLE__
341         WM_keymap_add_item(keymap, "POSE_OT_copy", CKEY, KM_PRESS, KM_OSKEY, 0);
342         kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_OSKEY, 0);
343         RNA_boolean_set(kmi->ptr, "flipped", false);
344         kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_OSKEY | KM_SHIFT, 0);
345         RNA_boolean_set(kmi->ptr, "flipped", true);
346 #endif
347
348         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", AKEY, KM_PRESS, 0, 0);
349         RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
350         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
351         RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
352
353         WM_keymap_add_item(keymap, "POSE_OT_select_parent", PKEY, KM_PRESS, KM_SHIFT, 0);
354
355         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
356         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
357         RNA_boolean_set(kmi->ptr, "extend", false);
358         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
359         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
360         RNA_boolean_set(kmi->ptr, "extend", true);
361         
362         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
363         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
364         RNA_boolean_set(kmi->ptr, "extend", false);
365         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
366         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
367         RNA_boolean_set(kmi->ptr, "extend", true);
368
369         WM_keymap_add_item(keymap, "POSE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
370         WM_keymap_add_item(keymap, "POSE_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
371         WM_keymap_add_item(keymap, "POSE_OT_select_mirror", FKEY, KM_PRESS, KM_SHIFT, 0);
372         
373         WM_keymap_add_item(keymap, "POSE_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
374         WM_keymap_add_item(keymap, "POSE_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
375         WM_keymap_add_item(keymap, "POSE_OT_ik_add", IKEY, KM_PRESS, /*KM_CTRL|*/ KM_SHIFT, 0);
376         WM_keymap_add_item(keymap, "POSE_OT_ik_clear", IKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
377         
378         WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_group", GKEY, KM_PRESS, KM_CTRL, 0);
379         
380         /* set flags */
381         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
382         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
383         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
384
385         /* armature/bone layers */
386         WM_keymap_add_item(keymap, "ARMATURE_OT_layers_show_all", ACCENTGRAVEKEY, KM_PRESS, KM_CTRL, 0);
387         WM_keymap_add_item(keymap, "ARMATURE_OT_armature_layers", MKEY, KM_PRESS, KM_SHIFT, 0);
388         WM_keymap_add_item(keymap, "POSE_OT_bone_layers", MKEY, KM_PRESS, 0, 0);
389         
390         /* special transforms: */
391         /*  1) envelope/b-bone size */
392         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
393         RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
394         
395         /* keyframes management */
396         WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0);
397         WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete_v3d", IKEY, KM_PRESS, KM_ALT, 0);
398         WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL | KM_SHIFT | KM_ALT, 0);
399         
400         /* Pose -> PoseLib ------------- */
401         /* only set in posemode, by space_view3d listener */
402         WM_keymap_add_item(keymap, "POSELIB_OT_browse_interactive", LKEY, KM_PRESS, KM_CTRL, 0);
403         
404         WM_keymap_add_item(keymap, "POSELIB_OT_pose_add", LKEY, KM_PRESS, KM_SHIFT, 0);
405         WM_keymap_add_item(keymap, "POSELIB_OT_pose_remove", LKEY, KM_PRESS, KM_ALT, 0);
406         WM_keymap_add_item(keymap, "POSELIB_OT_pose_rename", LKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
407         
408         /* Pose -> Pose Sliding ------------- */
409         /* only set in posemode, by space_view3d listener */
410         WM_keymap_add_item(keymap, "POSE_OT_push", EKEY, KM_PRESS, KM_CTRL, 0);
411         WM_keymap_add_item(keymap, "POSE_OT_relax", EKEY, KM_PRESS, KM_ALT, 0);
412         WM_keymap_add_item(keymap, "POSE_OT_breakdown", EKEY, KM_PRESS, KM_SHIFT, 0);
413
414         /* menus */
415         WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_specials", WKEY, KM_PRESS, 0, 0);
416 }
417