Merged changes in the trunk up to revision 55357.
[blender.git] / source / blender / editors / mesh / mesh_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/mesh/mesh_ops.c
28  *  \ingroup edmesh
29  */
30
31
32
33
34
35 #include "BLI_math.h"
36
37
38 #include "RNA_access.h"
39
40 #include "WM_api.h"
41 #include "WM_types.h"
42
43 #include "ED_object.h"
44 #include "ED_mesh.h"
45 #include "ED_screen.h"
46
47
48 #include "mesh_intern.h"
49
50 /**************************** registration **********************************/
51
52 void ED_operatortypes_mesh(void)
53 {
54         WM_operatortype_append(MESH_OT_select_all);
55         WM_operatortype_append(MESH_OT_select_interior_faces);
56         WM_operatortype_append(MESH_OT_select_more);
57         WM_operatortype_append(MESH_OT_select_less);
58         WM_operatortype_append(MESH_OT_select_non_manifold);
59         WM_operatortype_append(MESH_OT_select_linked);
60         WM_operatortype_append(MESH_OT_select_linked_pick);
61         WM_operatortype_append(MESH_OT_select_random);
62         WM_operatortype_append(MESH_OT_select_ungrouped);
63         WM_operatortype_append(MESH_OT_hide);
64         WM_operatortype_append(MESH_OT_reveal);
65         WM_operatortype_append(MESH_OT_select_face_by_sides);
66         WM_operatortype_append(MESH_OT_select_loose_verts);
67         WM_operatortype_append(MESH_OT_select_mirror);
68         WM_operatortype_append(MESH_OT_normals_make_consistent);
69         WM_operatortype_append(MESH_OT_merge);
70         WM_operatortype_append(MESH_OT_subdivide);
71         WM_operatortype_append(MESH_OT_unsubdivide);
72         WM_operatortype_append(MESH_OT_faces_select_linked_flat);
73         WM_operatortype_append(MESH_OT_edges_select_sharp);
74         WM_operatortype_append(MESH_OT_primitive_plane_add);
75         WM_operatortype_append(MESH_OT_primitive_cube_add);
76         WM_operatortype_append(MESH_OT_primitive_circle_add);
77         WM_operatortype_append(MESH_OT_primitive_cylinder_add);
78         WM_operatortype_append(MESH_OT_primitive_cone_add);
79         WM_operatortype_append(MESH_OT_primitive_grid_add);
80         WM_operatortype_append(MESH_OT_primitive_monkey_add);
81         WM_operatortype_append(MESH_OT_primitive_uv_sphere_add);
82         WM_operatortype_append(MESH_OT_primitive_ico_sphere_add);
83         WM_operatortype_append(MESH_OT_duplicate);
84         WM_operatortype_append(MESH_OT_remove_doubles);
85         WM_operatortype_append(MESH_OT_spin);
86         WM_operatortype_append(MESH_OT_screw);
87
88         WM_operatortype_append(MESH_OT_extrude_region);
89         WM_operatortype_append(MESH_OT_extrude_faces_indiv);
90         WM_operatortype_append(MESH_OT_extrude_edges_indiv);
91         WM_operatortype_append(MESH_OT_extrude_verts_indiv);
92
93         WM_operatortype_append(MESH_OT_split);
94         WM_operatortype_append(MESH_OT_extrude_repeat);
95         WM_operatortype_append(MESH_OT_edge_rotate);
96         WM_operatortype_append(MESH_OT_select_vertex_path);
97         WM_operatortype_append(MESH_OT_loop_to_region);
98         WM_operatortype_append(MESH_OT_region_to_loop);
99         WM_operatortype_append(MESH_OT_select_axis);
100         
101         WM_operatortype_append(MESH_OT_uvs_rotate);
102         WM_operatortype_append(MESH_OT_uvs_reverse);
103         WM_operatortype_append(MESH_OT_colors_rotate);
104         WM_operatortype_append(MESH_OT_colors_reverse);
105         
106         WM_operatortype_append(MESH_OT_fill);
107         WM_operatortype_append(MESH_OT_beautify_fill);
108         WM_operatortype_append(MESH_OT_quads_convert_to_tris);
109         WM_operatortype_append(MESH_OT_tris_convert_to_quads);
110         WM_operatortype_append(MESH_OT_dissolve);
111         WM_operatortype_append(MESH_OT_dissolve_limited);
112         WM_operatortype_append(MESH_OT_faces_shade_smooth);
113         WM_operatortype_append(MESH_OT_faces_shade_flat);
114         WM_operatortype_append(MESH_OT_sort_elements);
115 #ifdef WITH_FREESTYLE
116         WM_operatortype_append(MESH_OT_mark_freestyle_face);
117 #endif
118
119         WM_operatortype_append(MESH_OT_delete);
120         WM_operatortype_append(MESH_OT_edge_collapse);
121         WM_operatortype_append(MESH_OT_edge_collapse_loop);
122
123         WM_operatortype_append(MESH_OT_separate);
124         WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
125         WM_operatortype_append(MESH_OT_loop_select);
126         WM_operatortype_append(MESH_OT_edge_face_add);
127         WM_operatortype_append(MESH_OT_select_shortest_path);
128         WM_operatortype_append(MESH_OT_select_similar);
129         WM_operatortype_append(MESH_OT_select_mode);
130         WM_operatortype_append(MESH_OT_loop_multi_select);
131         WM_operatortype_append(MESH_OT_mark_seam);
132         WM_operatortype_append(MESH_OT_mark_sharp);
133 #ifdef WITH_FREESTYLE
134         WM_operatortype_append(MESH_OT_mark_freestyle_edge);
135 #endif
136         WM_operatortype_append(MESH_OT_vertices_smooth);
137         WM_operatortype_append(MESH_OT_vertices_smooth_laplacian);
138         WM_operatortype_append(MESH_OT_noise);
139         WM_operatortype_append(MESH_OT_flip_normals);
140         WM_operatortype_append(MESH_OT_rip);
141         WM_operatortype_append(MESH_OT_blend_from_shape);
142         WM_operatortype_append(MESH_OT_shape_propagate_to_all);
143         
144         WM_operatortype_append(MESH_OT_uv_texture_add);
145         WM_operatortype_append(MESH_OT_uv_texture_remove);
146         WM_operatortype_append(MESH_OT_vertex_color_add);
147         WM_operatortype_append(MESH_OT_vertex_color_remove);
148         WM_operatortype_append(MESH_OT_customdata_clear_mask);
149         WM_operatortype_append(MESH_OT_customdata_clear_skin);
150         WM_operatortype_append(MESH_OT_drop_named_image);
151
152         WM_operatortype_append(MESH_OT_edgering_select);
153         WM_operatortype_append(MESH_OT_loopcut);
154
155         WM_operatortype_append(MESH_OT_solidify);
156         WM_operatortype_append(MESH_OT_select_nth);
157         WM_operatortype_append(MESH_OT_vert_connect);
158         WM_operatortype_append(MESH_OT_knife_tool);
159         WM_operatortype_append(MESH_OT_knife_project);
160
161         WM_operatortype_append(MESH_OT_bevel);
162
163         WM_operatortype_append(MESH_OT_select_next_loop);
164
165         WM_operatortype_append(MESH_OT_bridge_edge_loops);
166         WM_operatortype_append(MESH_OT_inset);
167         WM_operatortype_append(MESH_OT_wireframe);
168         WM_operatortype_append(MESH_OT_edge_split);
169
170 #ifdef WITH_BULLET
171         WM_operatortype_append(MESH_OT_convex_hull);
172 #endif
173
174         WM_operatortype_append(MESH_OT_symmetrize);
175
176 #ifdef WITH_GAMEENGINE
177         WM_operatortype_append(MESH_OT_navmesh_make);
178         WM_operatortype_append(MESH_OT_navmesh_face_copy);
179         WM_operatortype_append(MESH_OT_navmesh_face_add);
180         WM_operatortype_append(MESH_OT_navmesh_reset);
181         WM_operatortype_append(MESH_OT_navmesh_clear);
182 #endif
183 }
184
185 #if 0 /* UNUSED, remove? */
186 static int ED_operator_editmesh_face_select(bContext *C)
187 {
188         Object *obedit = CTX_data_edit_object(C);
189         if (obedit && obedit->type == OB_MESH) {
190                 BMEditMesh *em = BMEdit_FromObject(obedit);
191                 if (em && em->selectmode & SCE_SELECT_FACE) {
192                         return 1;
193                 }
194         }
195         return 0;
196 }
197 #endif
198
199 void ED_operatormacros_mesh(void)
200 {
201         wmOperatorType *ot;
202         wmOperatorTypeMacro *otmacro;
203         
204         ot = WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", "Cut mesh loop and slide it",
205                                           OPTYPE_UNDO | OPTYPE_REGISTER);
206         WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
207         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
208         RNA_boolean_set(otmacro->ptr, "release_confirm", false);
209
210         ot = WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", "Duplicate mesh and move",
211                                           OPTYPE_UNDO | OPTYPE_REGISTER);
212         WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
213         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
214         RNA_enum_set(otmacro->ptr, "proportional", 0);
215         RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
216
217         ot = WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", "Rip polygons and move the result",
218                                           OPTYPE_UNDO | OPTYPE_REGISTER);
219         otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
220         RNA_boolean_set(otmacro->ptr, "use_fill", FALSE);
221         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
222         RNA_enum_set(otmacro->ptr, "proportional", 0);
223         RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
224
225         /* annoying we can't pass 'use_fill' through the macro */
226         ot = WM_operatortype_append_macro("MESH_OT_rip_move_fill", "Rip Fill", "Rip-fill polygons and move the result",
227                                           OPTYPE_UNDO | OPTYPE_REGISTER);
228         otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
229         RNA_boolean_set(otmacro->ptr, "use_fill", TRUE);
230         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
231         RNA_enum_set(otmacro->ptr, "proportional", 0);
232         RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
233
234         ot = WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move",
235                                           "Extrude region and move result", OPTYPE_UNDO | OPTYPE_REGISTER);
236         otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
237         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
238         RNA_enum_set(otmacro->ptr, "proportional", 0);
239         RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
240
241         ot = WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move",
242                                           "Extrude faces and move result", OPTYPE_UNDO | OPTYPE_REGISTER);
243         otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
244         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
245         RNA_enum_set(otmacro->ptr, "proportional", 0);
246         RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
247
248         ot = WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move",
249                                           "Extrude edges and move result", OPTYPE_UNDO | OPTYPE_REGISTER);
250         otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
251         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
252         RNA_enum_set(otmacro->ptr, "proportional", 0);
253         RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
254
255         ot = WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move",
256                                           "Extrude vertices and move result", OPTYPE_UNDO | OPTYPE_REGISTER);
257         otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_indiv");
258         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
259         RNA_enum_set(otmacro->ptr, "proportional", 0);
260         RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
261 }
262
263 /* note mesh keymap also for other space? */
264 void ED_keymap_mesh(wmKeyConfig *keyconf)
265 {       
266         wmKeyMap *keymap;
267         wmKeyMapItem *kmi;
268         int i;
269         
270         keymap = WM_keymap_find(keyconf, "Mesh", 0, 0);
271         keymap->poll = ED_operator_editmesh;
272         
273         WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0);        
274         WM_keymap_add_item(keymap, "MESH_OT_inset", IKEY, KM_PRESS, 0, 0);
275
276         kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL, 0);
277         RNA_boolean_set(kmi->ptr, "vertex_only", FALSE);
278         kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
279         RNA_boolean_set(kmi->ptr, "vertex_only", TRUE);
280
281         /* selecting */
282         /* standard mouse selection goes via space_view3d */
283         kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
284         RNA_boolean_set(kmi->ptr, "extend", FALSE);
285         RNA_boolean_set(kmi->ptr, "deselect", FALSE);
286         RNA_boolean_set(kmi->ptr, "toggle", FALSE);
287         kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0);
288         RNA_boolean_set(kmi->ptr, "extend", FALSE);
289         RNA_boolean_set(kmi->ptr, "deselect", FALSE);
290         RNA_boolean_set(kmi->ptr, "toggle", TRUE);
291
292         kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT | KM_CTRL, 0);
293         RNA_boolean_set(kmi->ptr, "extend", FALSE);
294         RNA_boolean_set(kmi->ptr, "deselect", FALSE);
295         RNA_boolean_set(kmi->ptr, "toggle", FALSE);
296         kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT | KM_CTRL, 0);
297         RNA_boolean_set(kmi->ptr, "extend", FALSE);
298         RNA_boolean_set(kmi->ptr, "deselect", FALSE);
299         RNA_boolean_set(kmi->ptr, "toggle", TRUE);
300
301         WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
302
303         kmi = WM_keymap_add_item(keymap, "MESH_OT_select_all", AKEY, KM_PRESS, 0, 0);
304         RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
305         kmi = WM_keymap_add_item(keymap, "MESH_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
306         RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
307
308         WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
309         WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
310         WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL | KM_SHIFT | KM_ALT), 0);
311         
312         WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
313         kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0);
314         RNA_boolean_set(kmi->ptr, "deselect", FALSE);
315         kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0);
316         RNA_boolean_set(kmi->ptr, "deselect", TRUE);
317         
318         WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL | KM_SHIFT | KM_ALT), 0);
319
320         WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
321         
322         /* selection mode */
323         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0);
324         
325         /* hide */
326         kmi = WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0);
327         RNA_boolean_set(kmi->ptr, "unselected", FALSE);
328         kmi = WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
329         RNA_boolean_set(kmi->ptr, "unselected", TRUE);
330         WM_keymap_add_item(keymap, "MESH_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
331
332         /* tools */
333         kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
334         RNA_boolean_set(kmi->ptr, "inside", FALSE);
335         kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
336         RNA_boolean_set(kmi->ptr, "inside", TRUE);
337         
338         WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */
339         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0);
340         
341         WM_keymap_add_item(keymap, "TRANSFORM_OT_edge_crease", EKEY, KM_PRESS, KM_SHIFT, 0);
342         
343         WM_keymap_add_item(keymap, "MESH_OT_spin", RKEY, KM_PRESS, KM_ALT, 0);
344         
345         WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_ALT, 0);
346         WM_keymap_add_item(keymap, "MESH_OT_beautify_fill", FKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
347
348         kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
349         RNA_boolean_set(kmi->ptr, "use_beauty", TRUE);
350         kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
351         RNA_boolean_set(kmi->ptr, "use_beauty", FALSE);
352
353         WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
354
355         WM_keymap_add_item(keymap, "MESH_OT_rip_move", VKEY, KM_PRESS, 0, 0);
356         WM_keymap_add_item(keymap, "MESH_OT_rip_move_fill", VKEY, KM_PRESS, KM_ALT, 0);
357
358         WM_keymap_add_item(keymap, "MESH_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
359
360         WM_keymap_add_item(keymap, "TRANSFORM_OT_shrink_fatten", SKEY, KM_PRESS, KM_ALT, 0);
361
362         /* add/remove */
363         WM_keymap_add_item(keymap, "MESH_OT_edge_face_add", FKEY, KM_PRESS, 0, 0);
364 //      WM_keymap_add_item(keymap, "MESH_OT_skin", FKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); /* python, removed */
365         WM_keymap_add_item(keymap, "MESH_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
366         
367         WM_keymap_add_menu(keymap, "INFO_MT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0);
368         
369         WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, 0, 0);
370         WM_keymap_add_item(keymap, "MESH_OT_split", YKEY, KM_PRESS, 0, 0);
371         WM_keymap_add_item(keymap, "MESH_OT_vert_connect", JKEY, KM_PRESS, 0, 0);
372
373         /* Vertex Slide */
374         WM_keymap_add_item(keymap, "TRANSFORM_OT_vert_slide", VKEY, KM_PRESS, KM_SHIFT, 0);
375         /* use KM_CLICK because same key is used for tweaks */
376         kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
377         RNA_boolean_set(kmi->ptr, "rotate_source", TRUE);
378         kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT | KM_CTRL, 0);
379         RNA_boolean_set(kmi->ptr, "rotate_source", FALSE);
380
381         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_delete", XKEY, KM_PRESS, 0, 0);
382         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_delete", DELKEY, KM_PRESS, 0, 0);
383         
384         kmi = WM_keymap_add_item(keymap, "MESH_OT_knife_tool", KKEY, KM_PRESS, 0, 0);
385         RNA_boolean_set(kmi->ptr, "use_occlude_geometry", TRUE);
386         RNA_boolean_set(kmi->ptr, "only_selected",          FALSE);
387
388         kmi = WM_keymap_add_item(keymap, "MESH_OT_knife_tool", KKEY, KM_PRESS, KM_SHIFT, 0);
389         RNA_boolean_set(kmi->ptr, "use_occlude_geometry", FALSE);
390         RNA_boolean_set(kmi->ptr, "only_selected",          TRUE);
391         
392         WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
393
394         /* menus */
395         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_specials", WKEY, KM_PRESS, 0, 0);
396         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_faces", FKEY, KM_PRESS, KM_CTRL, 0);
397         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_edges", EKEY, KM_PRESS, KM_CTRL, 0);
398         WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_vertices", VKEY, KM_PRESS, KM_CTRL, 0);
399         WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0);
400         WM_keymap_add_menu(keymap, "VIEW3D_MT_uv_map", UKEY, KM_PRESS, 0, 0);
401         WM_keymap_add_menu(keymap, "VIEW3D_MT_vertex_group", GKEY, KM_PRESS, KM_CTRL, 0);
402         
403         /* useful stuff from object-mode */
404         for (i = 0; i <= 5; i++) {
405                 kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0);
406                 RNA_int_set(kmi->ptr, "level", i);
407         }
408         
409         ED_keymap_proportional_cycle(keyconf, keymap);
410         ED_keymap_proportional_editmode(keyconf, keymap, TRUE);
411
412         knifetool_modal_keymap(keyconf);
413 }
414