remove C specials menus, reuse python ones from the header menu instead.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 12 Oct 2009 21:06:03 +0000 (21:06 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 12 Oct 2009 21:06:03 +0000 (21:06 +0000)
release/scripts/ui/space_info.py
release/scripts/ui/space_view3d.py
source/blender/editors/mesh/mesh_ops.c
source/blenderplayer/bad_level_call_stubs/stubs.c

index 5a7a3b61cc234e1c09cf960981bd31f72d4f8914..aef90d818d1e1e94602755da8a6449eacabc768a 100644 (file)
@@ -41,7 +41,7 @@ class INFO_HT_header(bpy.types.Header):
                layout.itemL(text=scene.statistics())
 
 
-class INFO_MT_file(dynamic_menu.DynMenu):
+class INFO_MT_file(bpy.types.Menu):
        __label__ = "File"
 
        def draw(self, context):
index 832ec0c5999d04b55ab384b09d77803ab52c250c..96f622af54b10558253ba8b3856635c0007299bb 100644 (file)
@@ -1,6 +1,8 @@
 
 import bpy
 
+import dynamic_menu
+
 # ********** Header **********
 
 class VIEW3D_HT_header(bpy.types.Header):
@@ -742,11 +744,37 @@ class VIEW3D_MT_edit_mesh(bpy.types.Menu):
                
                layout.itemM("VIEW3D_MT_edit_mesh_showhide")
 
+# Only used by the menu
+class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
+       __label__ = "Specials"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               layout.operator_context = 'INVOKE_REGION_WIN'
+               
+               layout.itemO("mesh.subdivide", text="Subdivide")
+               layout.item_floatO("mesh.subdivide", "smoothness", 1.0, text="Subdivide Smooth")
+               layout.itemO("mesh.merge", text="Merge...")
+               layout.itemO("mesh.remove_doubles", text="Remove Doubles")
+               layout.itemO("mesh.hide", text="Hide")
+               layout.itemO("mesh.reveal", text="Reveal")
+               layout.itemO("mesh.select_inverse", text="Select Inverse")
+               layout.itemO("mesh.flip_normals")
+               layout.itemO("mesh.vertices_smooth", text="Smooth")
+               # layout.itemO("mesh.bevel", text="Bevel")
+               layout.itemO("mesh.faces_shade_smooth")
+               layout.itemO("mesh.faces_shade_flat")
+               # layout.itemO("mesh.blend_from_shape", text="Blend From Shape")
+               # layout.itemO("mesh.shape_propagate_to_all", text="Propagate to All Shapes")
+               layout.itemO("mesh.select_vertex_path", text="Select Vertex Path")
+
 class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
        __label__ = "Vertices"
 
        def draw(self, context):
                layout = self.layout
+               layout.operator_context = 'INVOKE_REGION_WIN'
                
                layout.itemO("mesh.merge")
                layout.itemO("mesh.rip")
@@ -757,13 +785,19 @@ class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
                
                layout.itemO("mesh.vertices_smooth")
                layout.itemO("mesh.remove_doubles")
+               
+               layout.itemO("mesh.select_vertex_path", text="Select Vertex Path")
+               
+               # uiItemO(layout, "Blend From Shape", 0, "mesh.blend_from_shape");
+               # uiItemO(layout, "Propagate to All Shapes", 0, "mesh.shape_propagate_to_all");
 
 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
        __label__ = "Edges"
 
        def draw(self, context):
                layout = self.layout
-
+               layout.operator_context = 'INVOKE_REGION_WIN'
+               
                layout.itemO("mesh.edge_face_add")
                layout.itemO("mesh.subdivide")
 
@@ -782,12 +816,30 @@ class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
                layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW")
                layout.item_enumO("mesh.edge_rotate", "direction", 'CCW', text="Rotate Edge CCW")
 
-class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
+               layout.itemS()
+               
+               layout.itemO("TFM_OT_edge_slide", text="Edge Slide")
+               layout.itemO("mesh.loop_multi_select", text="Edge Loop")
+
+               # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
+               # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
+               
+               layout.item_booleanO("mesh.loop_multi_select", "ring", True, text="Edge Ring")
+               
+               layout.itemO("mesh.loop_to_region")
+               layout.itemO("mesh.region_to_loop")
+
+
+class VIEW3D_MT_edit_mesh_faces(dynamic_menu.DynMenu):
        __label__ = "Faces"
 
        def draw(self, context):
                layout = self.layout
-
+               layout.operator_context = 'INVOKE_REGION_WIN'
+               
+               layout.itemO("mesh.flip_normals")
+               # layout.itemO("mesh.bevel")
+               # layout.itemO("mesh.bevel")
                layout.itemO("mesh.edge_face_add")
                layout.itemO("mesh.fill")
                layout.itemO("mesh.beauty_fill")
@@ -802,6 +854,21 @@ class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
                
                layout.itemO("mesh.faces_shade_smooth")
                layout.itemO("mesh.faces_shade_flat")
+               
+               layout.itemS()
+
+               # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
+               # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
+               
+               layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW")
+               
+               layout.itemS()
+               
+               layout.item_menu_enumO("mesh.uvs_rotate", "direction")
+               layout.item_menu_enumO("mesh.uvs_mirror", "axis")
+               layout.item_menu_enumO("mesh.colors_rotate", "direction")
+               layout.item_menu_enumO("mesh.colors_mirror", "axis")
+
 
 class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
        __label__ = "Normals"
@@ -1264,14 +1331,14 @@ class VIEW3D_PT_transform_orientations(bpy.types.Panel):
                col = layout.column()
 
                col.itemR(view, "transform_orientation")
-               col.itemO("TFM_OT_create_orientation", text="Create")
+               col.itemO("tfm.create_orientation", text="Create")
                
 #              orientation_index = view.__rna__.properties["transform_orientation"].items[view.transform_orientation].value
 #              
 #              if orientation_index >= 4:
 #                      orientation = context.scene.orientations[orientation_index - 4]
 #                      col.itemR(orientation, "name")
-               col.itemO("TFM_OT_delete_orientation", text="Delete")
+               col.itemO("tfm.delete_orientation", text="Delete")
 
 # Operators 
 
index 9e74c5717c64753533d0869e9163479a23beac41..eaaf76d7bc7bcdd2f888231e0fe6bd425a6cf721 100644 (file)
 
 #include "mesh_intern.h"
 
-/******************************** menus *************************************/
-
-static int vertex_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       uiPopupMenu *pup;
-       uiLayout *layout;
-
-       pup= uiPupMenuBegin(C, "Vertex Specials", 0);
-       layout= uiPupMenuLayout(pup);
-       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
-
-       uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles");
-       uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
-       uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth");
-       uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path"); 
-       //uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape");
-       //uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all");
-
-       uiPupMenuEnd(C, pup);
-       
-       return OPERATOR_CANCELLED;
-}
-
-static void MESH_OT_vertex_specials(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Vertex Specials";
-       //ot->description= "Perform special vertex operations.";
-       ot->idname= "MESH_OT_vertex_specials";
-       
-       /* api callbacks */
-       ot->invoke= vertex_specials_invoke;
-       ot->poll= ED_operator_editmesh;
-}
-
-static int edge_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       uiPopupMenu *pup;
-       uiLayout *layout;
-
-       pup= uiPupMenuBegin(C, "Edge Specials", 0);
-       layout= uiPupMenuLayout(pup);
-       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
-
-       uiItemO(layout, "Mark Seam", 0, "MESH_OT_mark_seam");
-       uiItemBooleanO(layout, "Clear Seam", 0, "MESH_OT_mark_seam", "clear", 1);
-       uiItemEnumO(layout, "Rotate Edge CW", 0, "MESH_OT_edge_rotate", "direction", 1);
-       uiItemEnumO(layout, "Rotate Edge CCW", 0, "MESH_OT_edge_rotate", "direction", 2);
-       //uiItemO(layout, "Loopcut", 0, "MESH_OT_loop_cut"); // CutEdgeloop(em, 1);
-       //uiItemO(layout, "Edge Slide", 0, "MESH_OT_edge_slide"); // EdgeSlide(em, 0,0.0);
-       uiItemO(layout, "Edge Slide", 0, "TFM_OT_edge_slide");
-       uiItemO(layout, "Edge Loop", 0, "MESH_OT_loop_multi_select");
-       uiItemBooleanO(layout, "Edge Ring", 0, "MESH_OT_loop_multi_select", "ring", 1);
-       uiItemO(layout, NULL, 0, "MESH_OT_loop_to_region");
-       uiItemO(layout, NULL, 0, "MESH_OT_region_to_loop");
-       uiItemO(layout, "Mark Sharp", 0, "MESH_OT_mark_sharp");
-       uiItemBooleanO(layout, "Clear Sharp", 0, "MESH_OT_mark_sharp", "clear", 1);
-
-       uiPupMenuEnd(C, pup);
-
-       return OPERATOR_CANCELLED;
-}
-
-static void MESH_OT_edge_specials(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Edge Specials";
-       //ot->description= "Perform special edge operations.";
-       ot->idname= "MESH_OT_edge_specials";
-       
-       /* api callbacks */
-       ot->invoke= edge_specials_invoke;
-       ot->poll= ED_operator_editmesh;
-}
-
-static int face_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       uiPopupMenu *pup;
-       uiLayout *layout;
-
-       pup= uiPupMenuBegin(C, "Face Specials", 0);
-       layout= uiPupMenuLayout(pup);
-       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
-
-       uiItemO(layout, NULL, 0, "MESH_OT_flip_normals");
-       // uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em)
-       uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth");
-       uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_flat");
-       uiItemO(layout, NULL, 0, "MESH_OT_quads_convert_to_tris");
-       uiItemO(layout, NULL, 0, "MESH_OT_tris_convert_to_quads");
-       uiItemO(layout, NULL, 0, "MESH_OT_edge_flip");
-
-       uiItemS(layout);
-
-       uiItemO(layout, NULL, 0, "MESH_OT_fill");
-       uiItemO(layout, NULL, 0, "MESH_OT_beauty_fill");
-
-       uiItemS(layout);
-
-       // uiItemO(layout, NULL, 0, "MESH_OT_face_mode"); // mesh_set_face_flags(em, 1);
-       // uiItemBooleanO(layout, NULL, 0, "MESH_OT_face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
-       //
-       // uiItemS(layout);
-
-       uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_rotate", "direction");
-       uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_mirror", "axis");
-       uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_rotate", "direction");
-       uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_mirror", "axis");
-
-       uiPupMenuEnd(C, pup);
-       
-       return OPERATOR_CANCELLED;
-}
-
-static void MESH_OT_face_specials(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Face Specials";
-       //ot->description= "Perform special face operations.";
-       ot->idname= "MESH_OT_face_specials";
-       
-       /* api callbacks */
-       ot->invoke= face_specials_invoke;
-       ot->poll= ED_operator_editmesh;
-}
-
-static int specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       uiPopupMenu *pup;
-       uiLayout *layout;
-
-       pup= uiPupMenuBegin(C, "Specials", 0);
-       layout= uiPupMenuLayout(pup);
-       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
-
-       uiItemO(layout, "Subdivide", 0, "MESH_OT_subdivide");
-       uiItemFloatO(layout, "Subdivide Smooth", 0, "MESH_OT_subdivide", "smoothness", 1.0f);
-       uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
-       uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles");
-       uiItemO(layout, "Hide", 0, "MESH_OT_hide");
-       uiItemO(layout, "Reveal", 0, "MESH_OT_reveal");
-       uiItemO(layout, "Select Inverse", 0, "MESH_OT_select_inverse");
-       uiItemO(layout, NULL, 0, "MESH_OT_flip_normals");
-       uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth");
-       // uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em)
-       uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth");
-       uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_flat");
-       //uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape");
-       //uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all");
-       uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path"); 
-       
-       uiPupMenuEnd(C, pup);
-       
-       return OPERATOR_CANCELLED;
-}
-
-static void MESH_OT_specials(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Specials";
-       //ot->description= "Perform special vertice, edge or face operations.";
-       ot->idname= "MESH_OT_specials";
-       
-       /* api callbacks */
-       ot->invoke= specials_invoke;
-       ot->poll= ED_operator_editmesh;
-}
-
 /**************************** registration **********************************/
 
 void ED_operatortypes_mesh(void)
@@ -313,11 +145,6 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_vertex_color_remove);
        WM_operatortype_append(MESH_OT_sticky_add);
        WM_operatortype_append(MESH_OT_sticky_remove);
-
-       WM_operatortype_append(MESH_OT_vertex_specials);
-       WM_operatortype_append(MESH_OT_edge_specials);
-       WM_operatortype_append(MESH_OT_face_specials);
-       WM_operatortype_append(MESH_OT_specials);
        
        WM_operatortype_append(MESH_OT_edgering_select);
        WM_operatortype_append(MESH_OT_loopcut);
@@ -449,11 +276,18 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, 0, KKEY);
 
        /* menus */
-       WM_keymap_add_item(keymap, "MESH_OT_vertex_specials", VKEY, KM_PRESS, KM_CTRL, 0);
-       WM_keymap_add_item(keymap, "MESH_OT_edge_specials", EKEY, KM_PRESS, KM_CTRL, 0);
-       WM_keymap_add_item(keymap, "MESH_OT_face_specials", FKEY, KM_PRESS, KM_CTRL, 0);
-       WM_keymap_add_item(keymap, "MESH_OT_specials", WKEY, KM_PRESS, 0, 0);
+       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", WKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_specials");
+
+       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", FKEY, KM_PRESS, KM_CTRL, 0);
+       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_faces");
        
+       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", EKEY, KM_PRESS, KM_CTRL, 0);
+       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_edges");
+
+       kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", VKEY, KM_PRESS, KM_CTRL, 0);
+       RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_vertices");
+
        /* UV's */
        WM_keymap_add_item(keymap, "UV_OT_mapping_menu", UKEY, KM_PRESS, 0, 0);
 }
index 8b6143467b9a0a9416e9d716ac974837b8ab034d..ebd7b43962450a7f54a0fd5a676d5e292b2dc411 100644 (file)
@@ -215,4 +215,4 @@ void smoke_get_obstacle(void) {return;}
 void smoke_get_index(void) {return;}
 void smoke_step(void) {return;}
 
-char blender_path(){return NULL;}
\ No newline at end of file
+char blender_path(){return NULL;}