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