svn merge ^/trunk/blender -r41226:41227 .
[blender.git] / source / blender / editors / mesh / mesh_ops.c
index 077ad756150c9c59d34e2868f926e7a9cf1ac018..83abfc9d7b9502941e8986a7f33347a3022e5067 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -42,8 +40,6 @@
 #include "BLI_blenlib.h"
 #include "BLI_editVert.h"
 
-#include "BLF_api.h"
-
 #include "BKE_context.h"
 
 #include "RNA_access.h"
@@ -61,6 +57,7 @@
 
 /**************************** registration **********************************/
 
+void EXPORT_MESH_OT_wavefront(wmOperatorType *ot);
 void ED_operatortypes_mesh(void)
 {
        WM_operatortype_append(MESH_OT_select_all);
@@ -74,6 +71,7 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_hide);
        WM_operatortype_append(MESH_OT_reveal);
        WM_operatortype_append(MESH_OT_select_by_number_vertices);
+       WM_operatortype_append(MESH_OT_select_loose_verts);
        WM_operatortype_append(MESH_OT_select_mirror);
        WM_operatortype_append(MESH_OT_normals_make_consistent);
        WM_operatortype_append(MESH_OT_merge);
@@ -89,16 +87,18 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_primitive_monkey_add);
        WM_operatortype_append(MESH_OT_primitive_uv_sphere_add);
        WM_operatortype_append(MESH_OT_primitive_ico_sphere_add);
-       WM_operatortype_append(MESH_OT_fgon_clear);
-       WM_operatortype_append(MESH_OT_fgon_make);
        WM_operatortype_append(MESH_OT_duplicate);
        WM_operatortype_append(MESH_OT_remove_doubles);
        WM_operatortype_append(MESH_OT_vertices_sort);
        WM_operatortype_append(MESH_OT_vertices_randomize);
-       WM_operatortype_append(MESH_OT_extrude);
        WM_operatortype_append(MESH_OT_spin);
        WM_operatortype_append(MESH_OT_screw);
-       
+
+       WM_operatortype_append(MESH_OT_extrude_region);
+       WM_operatortype_append(MESH_OT_extrude_faces_indiv);
+       WM_operatortype_append(MESH_OT_extrude_edges_indiv);
+       WM_operatortype_append(MESH_OT_extrude_verts_indiv);
+
        WM_operatortype_append(MESH_OT_split);
        WM_operatortype_append(MESH_OT_extrude_repeat);
        WM_operatortype_append(MESH_OT_edge_rotate);
@@ -108,9 +108,7 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_select_axis);
        
        WM_operatortype_append(MESH_OT_uvs_rotate);
-       WM_operatortype_append(MESH_OT_uvs_mirror);
        WM_operatortype_append(MESH_OT_colors_rotate);
-       WM_operatortype_append(MESH_OT_colors_mirror);
        
        WM_operatortype_append(MESH_OT_fill);
        WM_operatortype_append(MESH_OT_beautify_fill);
@@ -135,7 +133,7 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_vertices_smooth);
        WM_operatortype_append(MESH_OT_noise);
        WM_operatortype_append(MESH_OT_flip_normals);
-       WM_operatortype_append(MESH_OT_knife_cut);
+       //WM_operatortype_append(MESH_OT_knife_cut);
        WM_operatortype_append(MESH_OT_rip);
        WM_operatortype_append(MESH_OT_blend_from_shape);
        WM_operatortype_append(MESH_OT_shape_propagate_to_all);
@@ -153,6 +151,23 @@ void ED_operatortypes_mesh(void)
 
        WM_operatortype_append(MESH_OT_solidify);
        WM_operatortype_append(MESH_OT_select_nth);
+       WM_operatortype_append(MESH_OT_vert_connect);
+       WM_operatortype_append(MESH_OT_knifetool);
+
+       WM_operatortype_append(MESH_OT_bevel);
+
+       WM_operatortype_append(MESH_OT_select_next_loop);
+       
+       WM_operatortype_append(EXPORT_MESH_OT_wavefront);
+       WM_operatortype_append(MESH_OT_bridge_edge_loops);
+
+#ifdef WITH_GAMEENGINE
+       WM_operatortype_append(MESH_OT_navmesh_make);
+       WM_operatortype_append(MESH_OT_navmesh_face_copy);
+       WM_operatortype_append(MESH_OT_navmesh_face_add);
+       WM_operatortype_append(MESH_OT_navmesh_reset);
+       WM_operatortype_append(MESH_OT_navmesh_clear);
+#endif
 }
 
 #if 0 /* UNUSED, remove? */
@@ -160,7 +175,7 @@ static int ED_operator_editmesh_face_select(bContext *C)
 {
        Object *obedit= CTX_data_edit_object(C);
        if(obedit && obedit->type==OB_MESH) {
-               EditMesh *em = ((Mesh *)obedit->data)->edit_mesh;
+               BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh;
                if (em && em->selectmode & SCE_SELECT_FACE) {
                        return 1;
                }
@@ -174,53 +189,50 @@ void ED_operatormacros_mesh(void)
        wmOperatorType *ot;
        wmOperatorTypeMacro *otmacro;
        
-       ot= WM_operatortype_append_macro("MESH_OT_loopcut_slide", _("Loop Cut and Slide"), OPTYPE_UNDO|OPTYPE_REGISTER);
-       ot->description = _("Cut mesh loop and slide it");
+       ot= WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
+       ot->description = "Cut mesh loop and slide it";
        WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
        otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
        RNA_struct_idprops_unset(otmacro->ptr, "release_confirm");
 
-       ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", _("Add Duplicate"), OPTYPE_UNDO|OPTYPE_REGISTER);
-       ot->description = _("Duplicate mesh and move");
+       ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+       ot->description = "Duplicate mesh and move";
        WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
        otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
        RNA_enum_set(otmacro->ptr, "proportional", 0);
        RNA_boolean_set(otmacro->ptr, "mirror", 0);
 
-       ot= WM_operatortype_append_macro("MESH_OT_rip_move", _("Rip"), OPTYPE_UNDO|OPTYPE_REGISTER);
-       ot->description = _("Rip polygons and move the result");
+       ot= WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER);
+       ot->description = "Rip polygons and move the result";
        WM_operatortype_macro_define(ot, "MESH_OT_rip");
        otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
        RNA_enum_set(otmacro->ptr, "proportional", 0);
        RNA_boolean_set(otmacro->ptr, "mirror", 0);
 
-       ot= WM_operatortype_append_macro("MESH_OT_extrude_region_move", _("Extrude Region and Move"), OPTYPE_UNDO|OPTYPE_REGISTER);
-       ot->description = _("Extrude region and move result");
-       otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
-       RNA_enum_set(otmacro->ptr, "type", 1);
+       ot= WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+       ot->description = "Extrude region and move result";
+       otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
        otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
        RNA_enum_set(otmacro->ptr, "proportional", 0);
        RNA_boolean_set(otmacro->ptr, "mirror", 0);
 
-       ot= WM_operatortype_append_macro("MESH_OT_extrude_faces_move", _("Extrude Individual Faces and Move"), OPTYPE_UNDO|OPTYPE_REGISTER);
-       ot->description = _("Extrude faces and move result");
-       otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
-       RNA_enum_set(otmacro->ptr, "type", 2);
+       ot= WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+       ot->description = "Extrude faces and move result";
+       otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
        otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
        RNA_enum_set(otmacro->ptr, "proportional", 0);
        RNA_boolean_set(otmacro->ptr, "mirror", 0);
 
-       ot= WM_operatortype_append_macro("MESH_OT_extrude_edges_move", _("Extrude Only Edges and Move"), OPTYPE_UNDO|OPTYPE_REGISTER);
-       ot->description = _("Extrude edges and move result");
-       otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
-       RNA_enum_set(otmacro->ptr, "type", 3);
+       ot= WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+       ot->description = "Extrude edges and move result";
+       otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
        otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
        RNA_enum_set(otmacro->ptr, "proportional", 0);
        RNA_boolean_set(otmacro->ptr, "mirror", 0);
 
-       ot= WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", _("Extrude Only Vertices and Move"), OPTYPE_UNDO|OPTYPE_REGISTER);
-       ot->description = _("Extrude vertices and move result");
-       otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
+       ot= WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+       ot->description = "Extrude vertices and move result";
+       otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_indiv");
        RNA_enum_set(otmacro->ptr, "type", 4);
        otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
        RNA_enum_set(otmacro->ptr, "proportional", 0);
@@ -286,6 +298,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        
        WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "MESH_OT_beautify_fill", FKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+
        WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "MESH_OT_edge_flip", FKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
@@ -303,7 +316,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        WM_keymap_add_menu(keymap, "INFO_MT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0);
        
        WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "MESH_OT_split", YKEY, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_vert_connect", YKEY, KM_PRESS, 0, 0);
 
        /* use KM_CLICK because same key is used for tweaks */
        WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
@@ -312,8 +325,8 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0);
        
-       WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, 0, KKEY);
-       RNA_enum_set(WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, KM_SHIFT, KKEY)->ptr, "type", 2/*KNIFE_MIDPOINT*/);
+       WM_keymap_add_item(keymap, "MESH_OT_knifetool", KKEY, KM_PRESS, 0, 0);
+       //RNA_enum_set(WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, KM_SHIFT, KKEY)->ptr, "type", 2/*KNIFE_MIDPOINT*/);
        
        WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
 
@@ -333,5 +346,6 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        }
        
        ED_object_generic_keymap(keyconf, keymap, 3);
+       knifetool_modal_keymap(keyconf);
 }