knife 'mode' is now leftclick with ctrl-x held down, instead of ctrl-alt
[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 Loop", 0, "MESH_OT_loop_multi_select");
117         uiItemBooleanO(layout, "Edge Ring", 0, "MESH_OT_loop_multi_select", "ring", 1);
118         uiItemO(layout, NULL, 0, "MESH_OT_loop_to_region");
119         uiItemO(layout, NULL, 0, "MESH_OT_region_to_loop");
120         uiItemO(layout, "Mark Sharp", 0, "MESH_OT_mark_sharp");
121         uiItemBooleanO(layout, "Clear Sharp", 0, "MESH_OT_mark_sharp", "clear", 1);
122
123         uiPupMenuEnd(C, pup);
124
125         return OPERATOR_CANCELLED;
126 }
127
128 static void MESH_OT_edge_specials(wmOperatorType *ot)
129 {
130         /* identifiers */
131         ot->name= "Edge Specials";
132         //ot->description= "Perform special edge operations.";
133         ot->idname= "MESH_OT_edge_specials";
134         
135         /* api callbacks */
136         ot->invoke= edge_specials_invoke;
137         ot->poll= ED_operator_editmesh;
138 }
139
140 static int face_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
141 {
142         uiPopupMenu *pup;
143         uiLayout *layout;
144
145         pup= uiPupMenuBegin(C, "Face Specials", 0);
146         layout= uiPupMenuLayout(pup);
147         uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
148
149         uiItemO(layout, NULL, 0, "MESH_OT_flip_normals");
150         // uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em)
151         uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth");
152         uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_flat");
153         uiItemO(layout, NULL, 0, "MESH_OT_quads_convert_to_tris");
154         uiItemO(layout, NULL, 0, "MESH_OT_tris_convert_to_quads");
155         uiItemO(layout, NULL, 0, "MESH_OT_edge_flip");
156
157         uiItemS(layout);
158
159         uiItemO(layout, NULL, 0, "MESH_OT_fill");
160         uiItemO(layout, NULL, 0, "MESH_OT_beauty_fill");
161
162         uiItemS(layout);
163
164         // uiItemO(layout, NULL, 0, "MESH_OT_face_mode"); // mesh_set_face_flags(em, 1);
165         // uiItemBooleanO(layout, NULL, 0, "MESH_OT_face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
166         //
167         // uiItemS(layout);
168
169         uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_rotate", "direction");
170         uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_mirror", "axis");
171         uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_rotate", "direction");
172         uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_mirror", "axis");
173
174         uiPupMenuEnd(C, pup);
175         
176         return OPERATOR_CANCELLED;
177 }
178
179 static void MESH_OT_face_specials(wmOperatorType *ot)
180 {
181         /* identifiers */
182         ot->name= "Face Specials";
183         //ot->description= "Perform special face operations.";
184         ot->idname= "MESH_OT_face_specials";
185         
186         /* api callbacks */
187         ot->invoke= face_specials_invoke;
188         ot->poll= ED_operator_editmesh;
189 }
190
191 static int specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
192 {
193         uiPopupMenu *pup;
194         uiLayout *layout;
195
196         pup= uiPupMenuBegin(C, "Specials", 0);
197         layout= uiPupMenuLayout(pup);
198         uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
199
200         uiItemO(layout, "Subdivide", 0, "MESH_OT_subdivide");
201         uiItemFloatO(layout, "Subdivide Smooth", 0, "MESH_OT_subdivide", "smoothness", 1.0f);
202         uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
203         uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles");
204         uiItemO(layout, "Hide", 0, "MESH_OT_hide");
205         uiItemO(layout, "Reveal", 0, "MESH_OT_reveal");
206         uiItemO(layout, "Select Inverse", 0, "MESH_OT_select_inverse");
207         uiItemO(layout, NULL, 0, "MESH_OT_flip_normals");
208         uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth");
209         // uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em)
210         uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth");
211         uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_flat");
212         //uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape");
213         //uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all");
214         uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path"); 
215         
216         uiPupMenuEnd(C, pup);
217         
218         return OPERATOR_CANCELLED;
219 }
220
221 static void MESH_OT_specials(wmOperatorType *ot)
222 {
223         /* identifiers */
224         ot->name= "Specials";
225         //ot->description= "Perform special vertice, edge or face operations.";
226         ot->idname= "MESH_OT_specials";
227         
228         /* api callbacks */
229         ot->invoke= specials_invoke;
230         ot->poll= ED_operator_editmesh;
231 }
232
233 /**************************** registration **********************************/
234
235 void ED_operatortypes_mesh(void)
236 {
237         wmOperatorType *ot;
238         
239         WM_operatortype_append(MESH_OT_select_all_toggle);
240         WM_operatortype_append(MESH_OT_select_more);
241         WM_operatortype_append(MESH_OT_select_less);
242         WM_operatortype_append(MESH_OT_select_inverse);
243         WM_operatortype_append(MESH_OT_select_non_manifold);
244         WM_operatortype_append(MESH_OT_select_linked);
245         WM_operatortype_append(MESH_OT_select_linked_pick);
246         WM_operatortype_append(MESH_OT_select_random);
247         WM_operatortype_append(MESH_OT_selection_type);
248         WM_operatortype_append(MESH_OT_hide);
249         WM_operatortype_append(MESH_OT_reveal);
250         WM_operatortype_append(MESH_OT_select_by_number_vertices);
251         WM_operatortype_append(MESH_OT_normals_make_consistent);
252         WM_operatortype_append(MESH_OT_merge);
253         WM_operatortype_append(MESH_OT_subdivide);
254         WM_operatortype_append(MESH_OT_faces_select_linked_flat);
255         WM_operatortype_append(MESH_OT_edges_select_sharp);
256         WM_operatortype_append(MESH_OT_primitive_plane_add);
257         WM_operatortype_append(MESH_OT_primitive_cube_add);
258         WM_operatortype_append(MESH_OT_primitive_circle_add);
259         WM_operatortype_append(MESH_OT_primitive_cylinder_add);
260         WM_operatortype_append(MESH_OT_primitive_tube_add);
261         WM_operatortype_append(MESH_OT_primitive_cone_add);
262         WM_operatortype_append(MESH_OT_primitive_grid_add);
263         WM_operatortype_append(MESH_OT_primitive_monkey_add);
264         WM_operatortype_append(MESH_OT_primitive_uv_sphere_add);
265         WM_operatortype_append(MESH_OT_primitive_ico_sphere_add);
266         WM_operatortype_append(MESH_OT_fgon_clear);
267         WM_operatortype_append(MESH_OT_fgon_make);
268         WM_operatortype_append(MESH_OT_duplicate);
269         WM_operatortype_append(MESH_OT_remove_doubles);
270         WM_operatortype_append(MESH_OT_extrude);
271         WM_operatortype_append(MESH_OT_spin);
272         WM_operatortype_append(MESH_OT_screw);
273         
274         WM_operatortype_append(MESH_OT_vertices_transform_to_sphere);
275         WM_operatortype_append(MESH_OT_split);
276         WM_operatortype_append(MESH_OT_extrude_repeat);
277         WM_operatortype_append(MESH_OT_edge_rotate);
278         WM_operatortype_append(MESH_OT_select_vertex_path);
279         WM_operatortype_append(MESH_OT_loop_to_region);
280         WM_operatortype_append(MESH_OT_region_to_loop);
281         
282         WM_operatortype_append(MESH_OT_uvs_rotate);
283         WM_operatortype_append(MESH_OT_uvs_mirror);
284         WM_operatortype_append(MESH_OT_colors_rotate);
285         WM_operatortype_append(MESH_OT_colors_mirror);
286         
287         WM_operatortype_append(MESH_OT_fill);
288         WM_operatortype_append(MESH_OT_beauty_fill);
289         WM_operatortype_append(MESH_OT_quads_convert_to_tris);
290         WM_operatortype_append(MESH_OT_tris_convert_to_quads);
291         WM_operatortype_append(MESH_OT_edge_flip);
292         WM_operatortype_append(MESH_OT_faces_shade_smooth);
293         WM_operatortype_append(MESH_OT_faces_shade_flat);
294
295         WM_operatortype_append(MESH_OT_delete);
296
297         WM_operatortype_append(MESH_OT_separate);
298         WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
299         WM_operatortype_append(MESH_OT_loop_select);
300         WM_operatortype_append(MESH_OT_edge_face_add);
301         WM_operatortype_append(MESH_OT_select_shortest_path);
302         WM_operatortype_append(MESH_OT_select_similar);
303         WM_operatortype_append(MESH_OT_loop_multi_select);
304         WM_operatortype_append(MESH_OT_mark_seam);
305         WM_operatortype_append(MESH_OT_mark_sharp);
306         WM_operatortype_append(MESH_OT_vertices_smooth);
307         WM_operatortype_append(MESH_OT_flip_normals);
308         WM_operatortype_append(MESH_OT_knife_cut);
309         WM_operatortype_append(MESH_OT_rip);
310         
311         WM_operatortype_append(MESH_OT_uv_texture_add);
312         WM_operatortype_append(MESH_OT_uv_texture_remove);
313         WM_operatortype_append(MESH_OT_vertex_color_add);
314         WM_operatortype_append(MESH_OT_vertex_color_remove);
315         WM_operatortype_append(MESH_OT_sticky_add);
316         WM_operatortype_append(MESH_OT_sticky_remove);
317
318         WM_operatortype_append(MESH_OT_vertex_specials);
319         WM_operatortype_append(MESH_OT_edge_specials);
320         WM_operatortype_append(MESH_OT_face_specials);
321         WM_operatortype_append(MESH_OT_specials);
322         
323         WM_operatortype_append(MESH_OT_edgering_select);
324
325         /* macros */
326         ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
327         WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
328         WM_operatortype_macro_define(ot, "TFM_OT_translate");
329
330         ot= WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER);
331         WM_operatortype_macro_define(ot, "MESH_OT_rip");
332         WM_operatortype_macro_define(ot, "TFM_OT_translate");
333
334         ot= WM_operatortype_append_macro("MESH_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
335         WM_operatortype_macro_define(ot, "MESH_OT_extrude");
336         WM_operatortype_macro_define(ot, "TFM_OT_translate");
337
338         /*combining operators with invoke and exec portions doesn't work yet.
339         
340         ot= WM_operatortype_append_macro("MESH_OT_loopcut", "Loopcut", OPTYPE_UNDO|OPTYPE_REGISTER);
341         WM_operatortype_macro_define(ot, "MESH_OT_edgering_select");
342         WM_operatortype_macro_define(ot, "MESH_OT_subdivide");
343         */
344 }
345
346 /* note mesh keymap also for other space? */
347 void ED_keymap_mesh(wmWindowManager *wm)
348 {       
349         ListBase *keymap= WM_keymap_listbase(wm, "EditMesh", 0, 0);
350         wmKeymapItem *kmi;
351         
352         //WM_keymap_add_item(keymap, "MESH_OT_loopcut", RKEY, KM_PRESS, KM_CTRL, 0);
353
354         /* selecting */
355         /* standard mouse selection goes via space_view3d */
356         WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
357         kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
358         RNA_boolean_set(kmi->ptr, "extend", 1);
359
360         kmi= WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0);
361         kmi= WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0);
362         RNA_boolean_set(kmi->ptr, "extend", 1);
363
364         WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
365
366         WM_keymap_add_item(keymap, "MESH_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
367         WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
368         WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
369         WM_keymap_add_item(keymap, "MESH_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
370         WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0);
371         
372         WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
373         WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0);
374         RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1);
375         
376         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);
377         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);
378         
379         WM_keymap_add_item(keymap, "MESH_OT_vertices_transform_to_sphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT , 0);
380
381         WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
382         
383         /* selection mode */
384         WM_keymap_add_item(keymap, "MESH_OT_selection_type", TABKEY, KM_PRESS, KM_CTRL, 0);
385         
386         /* hide */
387         WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0);
388         RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
389         WM_keymap_add_item(keymap, "MESH_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
390         
391         /* tools */
392         WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
393         RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1);
394         
395         WM_keymap_add_item(keymap, "MESH_OT_extrude_move", EKEY, KM_PRESS, 0, 0);
396         
397         WM_keymap_add_item(keymap, "MESH_OT_spin", RKEY, KM_PRESS, KM_ALT, 0);
398         WM_keymap_add_item(keymap, "MESH_OT_screw", NINEKEY, KM_PRESS, KM_CTRL, 0);
399         
400         WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_SHIFT, 0);
401         WM_keymap_add_item(keymap, "MESH_OT_beauty_fill", FKEY, KM_PRESS, KM_ALT, 0);
402         WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
403         WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
404         WM_keymap_add_item(keymap, "MESH_OT_edge_flip", FKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
405         
406         WM_keymap_add_item(keymap, "MESH_OT_split", FOURKEY, KM_PRESS, KM_CTRL, 0);
407         WM_keymap_add_item(keymap, "MESH_OT_extrude_repeat", FOURKEY, KM_PRESS, KM_ALT, 0);
408         WM_keymap_add_item(keymap, "MESH_OT_edge_rotate", FIVEKEY, KM_PRESS, KM_CTRL, 0);
409         
410         WM_keymap_add_item(keymap, "MESH_OT_loop_to_region",SIXKEY, KM_PRESS, KM_CTRL, 0);
411         WM_keymap_add_item(keymap, "MESH_OT_region_to_loop",SIXKEY, KM_PRESS, KM_ALT, 0);
412         
413         WM_keymap_add_item(keymap, "MESH_OT_uvs_rotate",SEVENKEY, KM_PRESS, KM_CTRL, 0);
414         WM_keymap_add_item(keymap, "MESH_OT_uvs_mirror",SEVENKEY, KM_PRESS, KM_ALT, 0);
415         WM_keymap_add_item(keymap, "MESH_OT_colors_rotate",EIGHTKEY, KM_PRESS, KM_CTRL, 0);
416         WM_keymap_add_item(keymap, "MESH_OT_colors_mirror",EIGHTKEY, KM_PRESS, KM_ALT, 0);
417
418         WM_keymap_add_item(keymap, "MESH_OT_rip_move",VKEY, KM_PRESS, 0, 0);
419         WM_keymap_add_item(keymap, "MESH_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
420
421         /* add/remove */
422         WM_keymap_add_item(keymap, "MESH_OT_edge_face_add", FKEY, KM_PRESS, 0, 0);
423         WM_keymap_add_item(keymap, "MESH_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
424         WM_keymap_add_item(keymap, "OBJECT_OT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0);
425         WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, KM_SHIFT, 0);
426                                                 /* use KM_RELEASE because same key is used for tweaks */
427         WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", LEFTMOUSE, KM_RELEASE, KM_CTRL, 0);
428         
429         WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0);
430         
431         WM_keymap_add_item(keymap, "MESH_OT_fgon_make", FKEY, KM_PRESS, KM_ALT, 0);
432         WM_keymap_add_item(keymap, "MESH_OT_fgon_clear", FKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
433         
434         WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, XKEY);
435
436         /* menus */
437         WM_keymap_add_item(keymap, "MESH_OT_vertex_specials", VKEY, KM_PRESS, KM_CTRL, 0);
438         WM_keymap_add_item(keymap, "MESH_OT_edge_specials", EKEY, KM_PRESS, KM_CTRL, 0);
439         WM_keymap_add_item(keymap, "MESH_OT_face_specials", FKEY, KM_PRESS, KM_CTRL, 0);
440         WM_keymap_add_item(keymap, "MESH_OT_specials", WKEY, KM_PRESS, 0, 0);
441         
442         /* UV's */
443         WM_keymap_add_item(keymap, "UV_OT_mapping_menu", UKEY, KM_PRESS, 0, 0);
444 }
445