macro's can set options for the operators they execute
[blender.git] / source / blender / editors / mesh / mesh_ops.c
1 /**
2  * $Id:
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2009 Blender Foundation.
21  * All rights reserved.
22  *
23  * 
24  * Contributor(s): Blender Foundation
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 #include <stdlib.h>
30 #include <math.h>
31
32 #include "MEM_guardedalloc.h"
33
34 #include "DNA_object_types.h"
35 #include "DNA_scene_types.h"
36 #include "DNA_screen_types.h"
37 #include "DNA_space_types.h"
38 #include "DNA_userdef_types.h"
39 #include "DNA_view3d_types.h"
40 #include "DNA_windowmanager_types.h"
41
42 #include "BLI_arithb.h"
43 #include "BLI_blenlib.h"
44 #include "BLI_editVert.h"
45
46 #include "BKE_context.h"
47 #include "BKE_global.h"
48 #include "BKE_mesh.h"
49 #include "BKE_utildefines.h"
50
51 #include "RNA_access.h"
52 #include "RNA_define.h"
53
54 #include "WM_api.h"
55 #include "WM_types.h"
56
57 #include "ED_mesh.h"
58 #include "ED_screen.h"
59 #include "ED_transform.h"
60 #include "ED_view3d.h"
61
62 #include "UI_interface.h"
63
64 #include "mesh_intern.h"
65
66 /******************************** menus *************************************/
67
68 static int vertex_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
69 {
70         uiPopupMenu *pup;
71         uiLayout *layout;
72
73         pup= uiPupMenuBegin(C, "Vertex Specials", 0);
74         layout= uiPupMenuLayout(pup);
75         uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
76
77         uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles");
78         uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
79         uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth");
80         uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path"); 
81         //uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape");
82         //uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all");
83
84         uiPupMenuEnd(C, pup);
85         
86         return OPERATOR_CANCELLED;
87 }
88
89 static void MESH_OT_vertex_specials(wmOperatorType *ot)
90 {
91         /* identifiers */
92         ot->name= "Vertex Specials";
93         //ot->description= "Perform special vertex operations.";
94         ot->idname= "MESH_OT_vertex_specials";
95         
96         /* api callbacks */
97         ot->invoke= vertex_specials_invoke;
98         ot->poll= ED_operator_editmesh;
99 }
100
101 static int edge_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
102 {
103         uiPopupMenu *pup;
104         uiLayout *layout;
105
106         pup= uiPupMenuBegin(C, "Edge Specials", 0);
107         layout= uiPupMenuLayout(pup);
108         uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
109
110         uiItemO(layout, "Mark Seam", 0, "MESH_OT_mark_seam");
111         uiItemBooleanO(layout, "Clear Seam", 0, "MESH_OT_mark_seam", "clear", 1);
112         uiItemEnumO(layout, "Rotate Edge CW", 0, "MESH_OT_edge_rotate", "direction", 1);
113         uiItemEnumO(layout, "Rotate Edge CCW", 0, "MESH_OT_edge_rotate", "direction", 2);
114         //uiItemO(layout, "Loopcut", 0, "MESH_OT_loop_cut"); // CutEdgeloop(em, 1);
115         //uiItemO(layout, "Edge Slide", 0, "MESH_OT_edge_slide"); // EdgeSlide(em, 0,0.0);
116         uiItemO(layout, "Edge Slide", 0, "TFM_OT_edge_slide");
117         uiItemO(layout, "Edge Loop", 0, "MESH_OT_loop_multi_select");
118         uiItemBooleanO(layout, "Edge Ring", 0, "MESH_OT_loop_multi_select", "ring", 1);
119         uiItemO(layout, NULL, 0, "MESH_OT_loop_to_region");
120         uiItemO(layout, NULL, 0, "MESH_OT_region_to_loop");
121         uiItemO(layout, "Mark Sharp", 0, "MESH_OT_mark_sharp");
122         uiItemBooleanO(layout, "Clear Sharp", 0, "MESH_OT_mark_sharp", "clear", 1);
123
124         uiPupMenuEnd(C, pup);
125
126         return OPERATOR_CANCELLED;
127 }
128
129 static void MESH_OT_edge_specials(wmOperatorType *ot)
130 {
131         /* identifiers */
132         ot->name= "Edge Specials";
133         //ot->description= "Perform special edge operations.";
134         ot->idname= "MESH_OT_edge_specials";
135         
136         /* api callbacks */
137         ot->invoke= edge_specials_invoke;
138         ot->poll= ED_operator_editmesh;
139 }
140
141 static int face_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
142 {
143         uiPopupMenu *pup;
144         uiLayout *layout;
145
146         pup= uiPupMenuBegin(C, "Face Specials", 0);
147         layout= uiPupMenuLayout(pup);
148         uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
149
150         uiItemO(layout, NULL, 0, "MESH_OT_flip_normals");
151         // uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em)
152         uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth");
153         uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_flat");
154         uiItemO(layout, NULL, 0, "MESH_OT_quads_convert_to_tris");
155         uiItemO(layout, NULL, 0, "MESH_OT_tris_convert_to_quads");
156         uiItemO(layout, NULL, 0, "MESH_OT_edge_flip");
157
158         uiItemS(layout);
159
160         uiItemO(layout, NULL, 0, "MESH_OT_fill");
161         uiItemO(layout, NULL, 0, "MESH_OT_beauty_fill");
162
163         uiItemS(layout);
164
165         // uiItemO(layout, NULL, 0, "MESH_OT_face_mode"); // mesh_set_face_flags(em, 1);
166         // uiItemBooleanO(layout, NULL, 0, "MESH_OT_face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
167         //
168         // uiItemS(layout);
169
170         uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_rotate", "direction");
171         uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_mirror", "axis");
172         uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_rotate", "direction");
173         uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_mirror", "axis");
174
175         uiPupMenuEnd(C, pup);
176         
177         return OPERATOR_CANCELLED;
178 }
179
180 static void MESH_OT_face_specials(wmOperatorType *ot)
181 {
182         /* identifiers */
183         ot->name= "Face Specials";
184         //ot->description= "Perform special face operations.";
185         ot->idname= "MESH_OT_face_specials";
186         
187         /* api callbacks */
188         ot->invoke= face_specials_invoke;
189         ot->poll= ED_operator_editmesh;
190 }
191
192 static int specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
193 {
194         uiPopupMenu *pup;
195         uiLayout *layout;
196
197         pup= uiPupMenuBegin(C, "Specials", 0);
198         layout= uiPupMenuLayout(pup);
199         uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
200
201         uiItemO(layout, "Subdivide", 0, "MESH_OT_subdivide");
202         uiItemFloatO(layout, "Subdivide Smooth", 0, "MESH_OT_subdivide", "smoothness", 1.0f);
203         uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
204         uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles");
205         uiItemO(layout, "Hide", 0, "MESH_OT_hide");
206         uiItemO(layout, "Reveal", 0, "MESH_OT_reveal");
207         uiItemO(layout, "Select Inverse", 0, "MESH_OT_select_inverse");
208         uiItemO(layout, NULL, 0, "MESH_OT_flip_normals");
209         uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth");
210         // uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em)
211         uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth");
212         uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_flat");
213         //uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape");
214         //uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all");
215         uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path"); 
216         
217         uiPupMenuEnd(C, pup);
218         
219         return OPERATOR_CANCELLED;
220 }
221
222 static void MESH_OT_specials(wmOperatorType *ot)
223 {
224         /* identifiers */
225         ot->name= "Specials";
226         //ot->description= "Perform special vertice, edge or face operations.";
227         ot->idname= "MESH_OT_specials";
228         
229         /* api callbacks */
230         ot->invoke= specials_invoke;
231         ot->poll= ED_operator_editmesh;
232 }
233
234 /**************************** registration **********************************/
235
236 void ED_operatortypes_mesh(void)
237 {
238         WM_operatortype_append(MESH_OT_select_all_toggle);
239         WM_operatortype_append(MESH_OT_select_more);
240         WM_operatortype_append(MESH_OT_select_less);
241         WM_operatortype_append(MESH_OT_select_inverse);
242         WM_operatortype_append(MESH_OT_select_non_manifold);
243         WM_operatortype_append(MESH_OT_select_linked);
244         WM_operatortype_append(MESH_OT_select_linked_pick);
245         WM_operatortype_append(MESH_OT_select_random);
246         WM_operatortype_append(MESH_OT_selection_type);
247         WM_operatortype_append(MESH_OT_hide);
248         WM_operatortype_append(MESH_OT_reveal);
249         WM_operatortype_append(MESH_OT_select_by_number_vertices);
250         WM_operatortype_append(MESH_OT_normals_make_consistent);
251         WM_operatortype_append(MESH_OT_merge);
252         WM_operatortype_append(MESH_OT_subdivide);
253         WM_operatortype_append(MESH_OT_faces_select_linked_flat);
254         WM_operatortype_append(MESH_OT_edges_select_sharp);
255         WM_operatortype_append(MESH_OT_primitive_plane_add);
256         WM_operatortype_append(MESH_OT_primitive_cube_add);
257         WM_operatortype_append(MESH_OT_primitive_circle_add);
258         WM_operatortype_append(MESH_OT_primitive_cylinder_add);
259         WM_operatortype_append(MESH_OT_primitive_tube_add);
260         WM_operatortype_append(MESH_OT_primitive_cone_add);
261         WM_operatortype_append(MESH_OT_primitive_grid_add);
262         WM_operatortype_append(MESH_OT_primitive_monkey_add);
263         WM_operatortype_append(MESH_OT_primitive_uv_sphere_add);
264         WM_operatortype_append(MESH_OT_primitive_ico_sphere_add);
265         WM_operatortype_append(MESH_OT_fgon_clear);
266         WM_operatortype_append(MESH_OT_fgon_make);
267         WM_operatortype_append(MESH_OT_duplicate);
268         WM_operatortype_append(MESH_OT_remove_doubles);
269         WM_operatortype_append(MESH_OT_extrude);
270         WM_operatortype_append(MESH_OT_spin);
271         WM_operatortype_append(MESH_OT_screw);
272         
273         WM_operatortype_append(MESH_OT_vertices_transform_to_sphere);
274         WM_operatortype_append(MESH_OT_split);
275         WM_operatortype_append(MESH_OT_extrude_repeat);
276         WM_operatortype_append(MESH_OT_edge_rotate);
277         WM_operatortype_append(MESH_OT_select_vertex_path);
278         WM_operatortype_append(MESH_OT_loop_to_region);
279         WM_operatortype_append(MESH_OT_region_to_loop);
280         
281         WM_operatortype_append(MESH_OT_uvs_rotate);
282         WM_operatortype_append(MESH_OT_uvs_mirror);
283         WM_operatortype_append(MESH_OT_colors_rotate);
284         WM_operatortype_append(MESH_OT_colors_mirror);
285         
286         WM_operatortype_append(MESH_OT_fill);
287         WM_operatortype_append(MESH_OT_beauty_fill);
288         WM_operatortype_append(MESH_OT_quads_convert_to_tris);
289         WM_operatortype_append(MESH_OT_tris_convert_to_quads);
290         WM_operatortype_append(MESH_OT_edge_flip);
291         WM_operatortype_append(MESH_OT_faces_shade_smooth);
292         WM_operatortype_append(MESH_OT_faces_shade_flat);
293
294         WM_operatortype_append(MESH_OT_delete);
295
296         WM_operatortype_append(MESH_OT_separate);
297         WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
298         WM_operatortype_append(MESH_OT_loop_select);
299         WM_operatortype_append(MESH_OT_edge_face_add);
300         WM_operatortype_append(MESH_OT_select_shortest_path);
301         WM_operatortype_append(MESH_OT_select_similar);
302         WM_operatortype_append(MESH_OT_loop_multi_select);
303         WM_operatortype_append(MESH_OT_mark_seam);
304         WM_operatortype_append(MESH_OT_mark_sharp);
305         WM_operatortype_append(MESH_OT_vertices_smooth);
306         WM_operatortype_append(MESH_OT_flip_normals);
307         WM_operatortype_append(MESH_OT_knife_cut);
308         WM_operatortype_append(MESH_OT_rip);
309         
310         WM_operatortype_append(MESH_OT_uv_texture_add);
311         WM_operatortype_append(MESH_OT_uv_texture_remove);
312         WM_operatortype_append(MESH_OT_vertex_color_add);
313         WM_operatortype_append(MESH_OT_vertex_color_remove);
314         WM_operatortype_append(MESH_OT_sticky_add);
315         WM_operatortype_append(MESH_OT_sticky_remove);
316
317         WM_operatortype_append(MESH_OT_vertex_specials);
318         WM_operatortype_append(MESH_OT_edge_specials);
319         WM_operatortype_append(MESH_OT_face_specials);
320         WM_operatortype_append(MESH_OT_specials);
321         
322         WM_operatortype_append(MESH_OT_edgering_select);
323         WM_operatortype_append(MESH_OT_loopcut);
324 }
325
326 void ED_operatormacros_mesh(void)
327 {
328         wmOperatorType *ot;
329         wmOperatorTypeMacro *otmacro;
330
331         /*combining operators with invoke and exec portions doesn't work yet.
332         
333         ot= WM_operatortype_append_macro("MESH_OT_loopcut", "Loopcut", OPTYPE_UNDO|OPTYPE_REGISTER);
334         WM_operatortype_macro_define(ot, "MESH_OT_edgering_select");
335         WM_operatortype_macro_define(ot, "MESH_OT_subdivide");
336         */
337
338         ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
339         WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
340         otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
341         RNA_enum_set(otmacro->ptr, "proportional", 0);
342
343         ot= WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER);
344         WM_operatortype_macro_define(ot, "MESH_OT_rip");
345         otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
346         RNA_enum_set(otmacro->ptr, "proportional", 0);
347
348         ot= WM_operatortype_append_macro("MESH_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
349         WM_operatortype_macro_define(ot, "MESH_OT_extrude");
350         otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
351         RNA_enum_set(otmacro->ptr, "proportional", 0);
352 }
353
354 /* note mesh keymap also for other space? */
355 void ED_keymap_mesh(wmKeyConfig *keyconf)
356 {       
357         wmKeyMap *keymap;
358         wmKeyMapItem *kmi;
359         
360         keymap= WM_keymap_find(keyconf, "EditMesh", 0, 0);
361         keymap->poll= ED_operator_editmesh;
362         
363         WM_keymap_add_item(keymap, "MESH_OT_loopcut", RKEY, KM_PRESS, KM_CTRL, 0);
364
365         /* selecting */
366         /* standard mouse selection goes via space_view3d */
367         WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
368         kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
369         RNA_boolean_set(kmi->ptr, "extend", 1);
370
371         kmi= WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0);
372         kmi= WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0);
373         RNA_boolean_set(kmi->ptr, "extend", 1);
374
375         WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
376
377         WM_keymap_add_item(keymap, "MESH_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
378         WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
379         WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
380         WM_keymap_add_item(keymap, "MESH_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
381         WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0);
382         
383         WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
384         WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0);
385         RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1);
386         
387         RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
388         RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_edges_select_sharp", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
389         
390         WM_keymap_add_item(keymap, "MESH_OT_vertices_transform_to_sphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT , 0);
391
392         WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
393         
394         /* selection mode */
395         WM_keymap_add_item(keymap, "MESH_OT_selection_type", TABKEY, KM_PRESS, KM_CTRL, 0);
396         
397         /* hide */
398         WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0);
399         RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
400         WM_keymap_add_item(keymap, "MESH_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
401         
402         /* tools */
403         WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
404         RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1);
405         
406         WM_keymap_add_item(keymap, "MESH_OT_extrude_move", EKEY, KM_PRESS, 0, 0);
407         
408         WM_keymap_add_item(keymap, "MESH_OT_spin", RKEY, KM_PRESS, KM_ALT, 0);
409         WM_keymap_add_item(keymap, "MESH_OT_screw", NINEKEY, KM_PRESS, KM_CTRL, 0);
410         
411         WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_SHIFT, 0);
412         WM_keymap_add_item(keymap, "MESH_OT_beauty_fill", FKEY, KM_PRESS, KM_ALT, 0);
413         WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
414         WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
415         WM_keymap_add_item(keymap, "MESH_OT_edge_flip", FKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
416         
417         WM_keymap_add_item(keymap, "MESH_OT_split", FOURKEY, KM_PRESS, KM_CTRL, 0);
418         WM_keymap_add_item(keymap, "MESH_OT_extrude_repeat", FOURKEY, KM_PRESS, KM_ALT, 0);
419         WM_keymap_add_item(keymap, "MESH_OT_edge_rotate", FIVEKEY, KM_PRESS, KM_CTRL, 0);
420         
421         WM_keymap_add_item(keymap, "MESH_OT_loop_to_region",SIXKEY, KM_PRESS, KM_CTRL, 0);
422         WM_keymap_add_item(keymap, "MESH_OT_region_to_loop",SIXKEY, KM_PRESS, KM_ALT, 0);
423         
424         WM_keymap_add_item(keymap, "MESH_OT_uvs_rotate",SEVENKEY, KM_PRESS, KM_CTRL, 0);
425         WM_keymap_add_item(keymap, "MESH_OT_uvs_mirror",SEVENKEY, KM_PRESS, KM_ALT, 0);
426         WM_keymap_add_item(keymap, "MESH_OT_colors_rotate",EIGHTKEY, KM_PRESS, KM_CTRL, 0);
427         WM_keymap_add_item(keymap, "MESH_OT_colors_mirror",EIGHTKEY, KM_PRESS, KM_ALT, 0);
428
429         WM_keymap_add_item(keymap, "MESH_OT_rip_move",VKEY, KM_PRESS, 0, 0);
430         WM_keymap_add_item(keymap, "MESH_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
431
432         /* add/remove */
433         WM_keymap_add_item(keymap, "MESH_OT_edge_face_add", FKEY, KM_PRESS, 0, 0);
434         WM_keymap_add_item(keymap, "MESH_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
435         
436         kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", AKEY, KM_PRESS, KM_SHIFT, 0);
437         RNA_string_set(kmi->ptr, "name", "INFO_MT_mesh_add");
438         
439         WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, 0, 0);
440                                                 /* use KM_RELEASE because same key is used for tweaks */
441         WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", LEFTMOUSE, KM_RELEASE, KM_CTRL, 0);
442         
443         WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0);
444         WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0);
445         
446         WM_keymap_add_item(keymap, "MESH_OT_fgon_make", FKEY, KM_PRESS, KM_ALT, 0);
447         WM_keymap_add_item(keymap, "MESH_OT_fgon_clear", FKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
448         
449         WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, 0, KKEY);
450
451         /* menus */
452         WM_keymap_add_item(keymap, "MESH_OT_vertex_specials", VKEY, KM_PRESS, KM_CTRL, 0);
453         WM_keymap_add_item(keymap, "MESH_OT_edge_specials", EKEY, KM_PRESS, KM_CTRL, 0);
454         WM_keymap_add_item(keymap, "MESH_OT_face_specials", FKEY, KM_PRESS, KM_CTRL, 0);
455         WM_keymap_add_item(keymap, "MESH_OT_specials", WKEY, KM_PRESS, 0, 0);
456         
457         /* UV's */
458         WM_keymap_add_item(keymap, "UV_OT_mapping_menu", UKEY, KM_PRESS, 0, 0);
459 }
460