More UI messages fixes and tweaks, BKE_report<->BKE_reportf, and stuff to translate...
[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
32 #include <stdlib.h>
33 #include <math.h>
34
35 #include "BLO_sys_types.h"
36
37 #include "BLI_math.h"
38 #include "BLI_blenlib.h"
39
40
41 #include "RNA_access.h"
42
43 #include "WM_api.h"
44 #include "WM_types.h"
45
46 #include "ED_armature.h"
47 #include "ED_screen.h"
48 #include "ED_transform.h"
49
50 #include "armature_intern.h"
51
52 /* ************************** registration **********************************/
53
54 /* Both operators ARMATURE_OT_xxx and POSE_OT_xxx here */
55 void ED_operatortypes_armature(void)
56 {
57         /* EDIT ARMATURE */
58         WM_operatortype_append(ARMATURE_OT_bone_primitive_add);
59         
60         WM_operatortype_append(ARMATURE_OT_align);
61         WM_operatortype_append(ARMATURE_OT_calculate_roll);
62         WM_operatortype_append(ARMATURE_OT_switch_direction);
63         WM_operatortype_append(ARMATURE_OT_subdivide);
64         
65         WM_operatortype_append(ARMATURE_OT_parent_set);
66         WM_operatortype_append(ARMATURE_OT_parent_clear);
67         
68         WM_operatortype_append(ARMATURE_OT_select_all);
69         WM_operatortype_append(ARMATURE_OT_select_inverse);
70         WM_operatortype_append(ARMATURE_OT_select_hierarchy);
71         WM_operatortype_append(ARMATURE_OT_select_linked);
72         WM_operatortype_append(ARMATURE_OT_select_similar);
73
74         WM_operatortype_append(ARMATURE_OT_delete);
75         WM_operatortype_append(ARMATURE_OT_duplicate);
76         WM_operatortype_append(ARMATURE_OT_extrude);
77         WM_operatortype_append(ARMATURE_OT_hide);
78         WM_operatortype_append(ARMATURE_OT_reveal);
79         WM_operatortype_append(ARMATURE_OT_click_extrude);
80         WM_operatortype_append(ARMATURE_OT_fill);
81         WM_operatortype_append(ARMATURE_OT_merge);
82         WM_operatortype_append(ARMATURE_OT_separate);
83         
84         WM_operatortype_append(ARMATURE_OT_autoside_names);
85         WM_operatortype_append(ARMATURE_OT_flip_names);
86         
87         WM_operatortype_append(ARMATURE_OT_layers_show_all);
88         WM_operatortype_append(ARMATURE_OT_armature_layers);
89         WM_operatortype_append(ARMATURE_OT_bone_layers);
90
91         /* SKETCH */    
92         WM_operatortype_append(SKETCH_OT_gesture);
93         WM_operatortype_append(SKETCH_OT_delete);
94         WM_operatortype_append(SKETCH_OT_draw_stroke);
95         WM_operatortype_append(SKETCH_OT_draw_preview);
96         WM_operatortype_append(SKETCH_OT_finish_stroke);
97         WM_operatortype_append(SKETCH_OT_cancel_stroke);
98         WM_operatortype_append(SKETCH_OT_convert);
99         WM_operatortype_append(SKETCH_OT_select);
100
101         /* POSE */
102         WM_operatortype_append(POSE_OT_hide);
103         WM_operatortype_append(POSE_OT_reveal);
104         
105         WM_operatortype_append(POSE_OT_armature_apply);
106         WM_operatortype_append(POSE_OT_visual_transform_apply);
107         
108         WM_operatortype_append(POSE_OT_rot_clear);
109         WM_operatortype_append(POSE_OT_loc_clear);
110         WM_operatortype_append(POSE_OT_scale_clear);
111         WM_operatortype_append(POSE_OT_transforms_clear);
112         WM_operatortype_append(POSE_OT_user_transforms_clear);
113         
114         WM_operatortype_append(POSE_OT_copy);
115         WM_operatortype_append(POSE_OT_paste);
116         
117         WM_operatortype_append(POSE_OT_select_all);
118
119         WM_operatortype_append(POSE_OT_select_parent);
120         WM_operatortype_append(POSE_OT_select_hierarchy);
121         WM_operatortype_append(POSE_OT_select_linked);
122         WM_operatortype_append(POSE_OT_select_constraint_target);
123         WM_operatortype_append(POSE_OT_select_grouped);
124         WM_operatortype_append(POSE_OT_select_flip_active);
125         
126         WM_operatortype_append(POSE_OT_group_add);
127         WM_operatortype_append(POSE_OT_group_remove);
128         WM_operatortype_append(POSE_OT_group_move);
129         WM_operatortype_append(POSE_OT_group_sort);
130         WM_operatortype_append(POSE_OT_group_assign);
131         WM_operatortype_append(POSE_OT_group_unassign);
132         WM_operatortype_append(POSE_OT_group_select);
133         WM_operatortype_append(POSE_OT_group_deselect);
134         
135         WM_operatortype_append(POSE_OT_paths_calculate);
136         WM_operatortype_append(POSE_OT_paths_update);
137         WM_operatortype_append(POSE_OT_paths_clear);
138         
139         WM_operatortype_append(POSE_OT_autoside_names);
140         WM_operatortype_append(POSE_OT_flip_names);
141         
142         WM_operatortype_append(POSE_OT_rotation_mode_set);
143
144         WM_operatortype_append(POSE_OT_quaternions_flip);
145         
146         WM_operatortype_append(POSE_OT_armature_layers);
147         WM_operatortype_append(POSE_OT_bone_layers);
148         
149         WM_operatortype_append(POSE_OT_propagate);
150         
151         /* POSELIB */
152         WM_operatortype_append(POSELIB_OT_browse_interactive);
153         WM_operatortype_append(POSELIB_OT_apply_pose);
154         
155         WM_operatortype_append(POSELIB_OT_pose_add);
156         WM_operatortype_append(POSELIB_OT_pose_remove);
157         WM_operatortype_append(POSELIB_OT_pose_rename);
158         
159         WM_operatortype_append(POSELIB_OT_new);
160         WM_operatortype_append(POSELIB_OT_unlink);
161         
162         WM_operatortype_append(POSELIB_OT_action_sanitize);
163         
164         /* POSE SLIDING */
165         WM_operatortype_append(POSE_OT_push);
166         WM_operatortype_append(POSE_OT_relax);
167         WM_operatortype_append(POSE_OT_breakdown);
168 }
169
170 void ED_operatormacros_armature(void)
171 {
172         wmOperatorType *ot;
173         wmOperatorTypeMacro *otmacro;
174         
175         ot = WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate",
176                                           "Make copies of the selected bones within the same armature and move them",
177                                           OPTYPE_UNDO | OPTYPE_REGISTER);
178         if (ot) {
179                 WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
180                 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
181                 RNA_enum_set(otmacro->ptr, "proportional", 0);
182         }
183
184         ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude",
185                                           "Create new bones from the selected joints and move them",
186                                           OPTYPE_UNDO | OPTYPE_REGISTER);
187         if (ot) {
188                 otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
189                 RNA_boolean_set(otmacro->ptr, "forked", FALSE);
190                 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
191                 RNA_enum_set(otmacro->ptr, "proportional", 0);
192         }
193         
194         /* XXX would it be nicer to just be able to have standard extrude_move, but set the forked property separate?
195          * that would require fixing a properties bug 19733 */
196         ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked",
197                                           "Create new bones from the selected joints and move them",
198                                           OPTYPE_UNDO | OPTYPE_REGISTER);
199         if (ot) {
200                 otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
201                 RNA_boolean_set(otmacro->ptr, "forked", TRUE);
202                 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
203                 RNA_enum_set(otmacro->ptr, "proportional", 0);
204         }
205 }
206
207 void ED_keymap_armature(wmKeyConfig *keyconf)
208 {
209         wmKeyMap *keymap;
210         wmKeyMapItem *kmi;
211         
212         /* Armature ------------------------ */
213         keymap = WM_keymap_find(keyconf, "Armature", 0, 0);
214         keymap->poll = ED_operator_editarmature;
215         
216         /* Armature -> Etch-A-Ton ------------------------ */
217         WM_keymap_add_item(keymap, "SKETCH_OT_delete", XKEY, KM_PRESS, 0, 0);
218         WM_keymap_add_item(keymap, "SKETCH_OT_delete", DELKEY, KM_PRESS, 0, 0);
219         WM_keymap_add_item(keymap, "SKETCH_OT_finish_stroke", RIGHTMOUSE, KM_PRESS, 0, 0);
220         WM_keymap_add_item(keymap, "SKETCH_OT_cancel_stroke", ESCKEY, KM_PRESS, 0, 0);
221         /* Already part of view3d select */
222         //WM_keymap_add_item(keymap, "SKETCH_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
223
224         /* sketch poll checks mode */   
225         WM_keymap_add_item(keymap, "SKETCH_OT_gesture", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
226         WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, 0, 0);
227         kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
228         RNA_boolean_set(kmi->ptr, "snap", TRUE);
229         WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, 0, 0);
230         kmi = WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, KM_CTRL, 0);
231         RNA_boolean_set(kmi->ptr, "snap", TRUE);
232
233         /* only set in editmode armature, by space_view3d listener */
234         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, 0, 0);
235         RNA_boolean_set(kmi->ptr, "unselected", FALSE);
236         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
237         RNA_boolean_set(kmi->ptr, "unselected", TRUE);
238
239         WM_keymap_add_item(keymap, "ARMATURE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
240         WM_keymap_add_item(keymap, "ARMATURE_OT_align", AKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
241         WM_keymap_add_item(keymap, "ARMATURE_OT_calculate_roll", NKEY, KM_PRESS, KM_CTRL, 0);
242         
243         WM_keymap_add_item(keymap, "ARMATURE_OT_switch_direction", FKEY, KM_PRESS, KM_ALT, 0);
244         
245         WM_keymap_add_item(keymap, "ARMATURE_OT_bone_primitive_add", AKEY, KM_PRESS, KM_SHIFT, 0);
246         
247         WM_keymap_add_item(keymap, "ARMATURE_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
248         WM_keymap_add_item(keymap, "ARMATURE_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
249         
250         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", AKEY, KM_PRESS, 0, 0);
251         RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
252         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
253         RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
254         
255         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
256         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
257         RNA_boolean_set(kmi->ptr, "extend", FALSE);
258         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
259         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
260         RNA_boolean_set(kmi->ptr, "extend", TRUE);
261         
262         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
263         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
264         RNA_boolean_set(kmi->ptr, "extend", FALSE);
265         kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
266         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
267         RNA_boolean_set(kmi->ptr, "extend", TRUE);
268
269         WM_keymap_add_item(keymap, "ARMATURE_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
270
271         WM_keymap_add_item(keymap, "ARMATURE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
272         
273         WM_keymap_add_item(keymap, "ARMATURE_OT_delete", XKEY, KM_PRESS, 0, 0);
274         WM_keymap_add_item(keymap, "ARMATURE_OT_delete", DELKEY, KM_PRESS, 0, 0);
275         WM_keymap_add_item(keymap, "ARMATURE_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
276         WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_move", EKEY, KM_PRESS, 0, 0);
277         WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_forked", EKEY, KM_PRESS, KM_SHIFT, 0);
278         WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
279         WM_keymap_add_item(keymap, "ARMATURE_OT_fill", FKEY, KM_PRESS, 0, 0);
280         WM_keymap_add_item(keymap, "ARMATURE_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
281         
282         WM_keymap_add_item(keymap, "ARMATURE_OT_separate", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
283         
284         /* set flags */
285         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
286         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
287         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
288                 
289         /* armature/bone layers */
290         WM_keymap_add_item(keymap, "ARMATURE_OT_layers_show_all", ACCENTGRAVEKEY, KM_PRESS, KM_CTRL, 0);
291         WM_keymap_add_item(keymap, "ARMATURE_OT_armature_layers", MKEY, KM_PRESS, KM_SHIFT, 0);
292         WM_keymap_add_item(keymap, "ARMATURE_OT_bone_layers", MKEY, KM_PRESS, 0, 0);
293         
294         /* special transforms: */
295         /*  1) envelope/b-bone size */
296         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
297         RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
298         /*  2) set roll */
299         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0);
300         RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ROLL);
301                 
302         /* menus */
303         WM_keymap_add_menu(keymap, "VIEW3D_MT_armature_specials", WKEY, KM_PRESS, 0, 0);
304
305         /* Pose ------------------------ */
306         /* only set in posemode, by space_view3d listener */
307         keymap = WM_keymap_find(keyconf, "Pose", 0, 0);
308         keymap->poll = ED_operator_posemode;
309         
310         /* set parent and add object are object-based operators, but we make them
311          * available here because it's useful to do in pose mode too */
312         WM_keymap_add_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
313         WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
314         
315         kmi = WM_keymap_add_item(keymap, "POSE_OT_hide", HKEY, KM_PRESS, 0, 0);
316         RNA_boolean_set(kmi->ptr, "unselected", FALSE);
317         kmi = WM_keymap_add_item(keymap, "POSE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
318         RNA_boolean_set(kmi->ptr, "unselected", TRUE);
319
320         WM_keymap_add_item(keymap, "POSE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
321         
322         WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_apply", AKEY, KM_PRESS, KM_CTRL, 0);
323         
324         /* TODO: clear pose */
325         WM_keymap_add_item(keymap, "POSE_OT_rot_clear", RKEY, KM_PRESS, KM_ALT, 0);
326         WM_keymap_add_item(keymap, "POSE_OT_loc_clear", GKEY, KM_PRESS, KM_ALT, 0);
327         WM_keymap_add_item(keymap, "POSE_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0);
328         
329         WM_keymap_add_item(keymap, "POSE_OT_quaternions_flip", FKEY, KM_PRESS, KM_ALT, 0);
330         
331         WM_keymap_add_item(keymap, "POSE_OT_rotation_mode_set", RKEY, KM_PRESS, KM_CTRL, 0);
332         
333         WM_keymap_add_item(keymap, "POSE_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
334         kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
335         RNA_boolean_set(kmi->ptr, "flipped", FALSE);
336
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         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", AKEY, KM_PRESS, 0, 0);
341         RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
342         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
343         RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
344
345         WM_keymap_add_item(keymap, "POSE_OT_select_parent", PKEY, KM_PRESS, KM_SHIFT, 0);
346
347         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
348         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
349         RNA_boolean_set(kmi->ptr, "extend", FALSE);
350         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
351         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
352         RNA_boolean_set(kmi->ptr, "extend", TRUE);
353         
354         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
355         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
356         RNA_boolean_set(kmi->ptr, "extend", FALSE);
357         kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
358         RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
359         RNA_boolean_set(kmi->ptr, "extend", TRUE);
360
361         WM_keymap_add_item(keymap, "POSE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
362         WM_keymap_add_item(keymap, "POSE_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
363         WM_keymap_add_item(keymap, "POSE_OT_select_flip_active", FKEY, KM_PRESS, KM_SHIFT, 0);
364         
365         WM_keymap_add_item(keymap, "POSE_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
366         WM_keymap_add_item(keymap, "POSE_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
367         WM_keymap_add_item(keymap, "POSE_OT_ik_add", IKEY, KM_PRESS, /*KM_CTRL|*/ KM_SHIFT, 0);
368         WM_keymap_add_item(keymap, "POSE_OT_ik_clear", IKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
369         
370         WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_group", GKEY, KM_PRESS, KM_CTRL, 0);
371         
372         /* set flags */
373         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
374         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
375         WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
376
377         /* armature/bone layers */
378         WM_keymap_add_item(keymap, "ARMATURE_OT_layers_show_all", ACCENTGRAVEKEY, KM_PRESS, KM_CTRL, 0);
379         WM_keymap_add_item(keymap, "POSE_OT_armature_layers", MKEY, KM_PRESS, KM_SHIFT, 0);
380         WM_keymap_add_item(keymap, "POSE_OT_bone_layers", MKEY, KM_PRESS, 0, 0);
381         
382         /* special transforms: */
383         /*  1) envelope/b-bone size */
384         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
385         RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
386         
387         /* keyframes management */
388         WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0);
389         WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete_v3d", IKEY, KM_PRESS, KM_ALT, 0);
390         WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL | KM_SHIFT | KM_ALT, 0);
391         
392         /* Pose -> PoseLib ------------- */
393         /* only set in posemode, by space_view3d listener */
394         WM_keymap_add_item(keymap, "POSELIB_OT_browse_interactive", LKEY, KM_PRESS, KM_CTRL, 0);
395         
396         WM_keymap_add_item(keymap, "POSELIB_OT_pose_add", LKEY, KM_PRESS, KM_SHIFT, 0);
397         WM_keymap_add_item(keymap, "POSELIB_OT_pose_remove", LKEY, KM_PRESS, KM_ALT, 0);
398         WM_keymap_add_item(keymap, "POSELIB_OT_pose_rename", LKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
399         
400         /* Pose -> Pose Sliding ------------- */
401         /* only set in posemode, by space_view3d listener */
402         WM_keymap_add_item(keymap, "POSE_OT_push", EKEY, KM_PRESS, KM_CTRL, 0);
403         WM_keymap_add_item(keymap, "POSE_OT_relax", EKEY, KM_PRESS, KM_ALT, 0);
404         WM_keymap_add_item(keymap, "POSE_OT_breakdown", EKEY, KM_PRESS, KM_SHIFT, 0);
405
406         /* menus */
407         WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_specials", WKEY, KM_PRESS, 0, 0);
408 }
409