[Bf-blender-cvs] [2b67bf7] pie-menus: Bring back extrude menu (was removed on earlier iteration of the code, no need to have this anymore)

Antony Riakiotakis noreply at git.blender.org
Sun Aug 3 16:53:11 CEST 2014


Commit: 2b67bf751041ce93952ba17fd1fa26f6798d33d2
Author: Antony Riakiotakis
Date:   Sun Aug 3 16:52:46 2014 +0200
Branches: pie-menus
https://developer.blender.org/rB2b67bf751041ce93952ba17fd1fa26f6798d33d2

Bring back extrude menu (was removed on earlier iteration of the code,
no need to have this anymore)

===================================================================

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/mesh/mesh_ops.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 9ff6cb7..fdd4ac8 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2188,6 +2188,46 @@ class VIEW3D_MT_edit_mesh_extrude(Menu):
             layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
         'REGION_VERT_NORMAL': lambda layout:
             layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Region (Vertex Normals)"),
+    }
+
+    @staticmethod
+    def extrude_options(context):
+        mesh = context.object.data
+        select_mode = context.tool_settings.mesh_select_mode
+
+        menu = []
+        if mesh.total_face_sel:
+            menu += ['REGION', 'REGION_VERT_NORMAL', 'FACE']
+        if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
+            menu += ['EDGE']
+        if mesh.total_vert_sel and select_mode[0]:
+            menu += ['VERT']
+
+        # should never get here
+        return menu
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+
+        for menu_id in self.extrude_options(context):
+            self._extrude_funcs[menu_id](layout)
+
+
+class VIEW3D_MT_edit_mesh_extrude_pie(Menu):
+    bl_label = "Extrude"
+
+    _extrude_funcs = {
+        'VERT': lambda layout:
+            layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
+        'EDGE': lambda layout:
+            layout.operator("mesh.extrude_edges_move", text="Edges Only"),
+        'FACE': lambda layout:
+            layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
+        'REGION': lambda layout:
+            layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
+        'REGION_VERT_NORMAL': lambda layout:
+            layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Region (Vertex Normals)"),
         'NULL': lambda layout:
             layout.separator(),
     }
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 6682203..6ddfefa 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -286,7 +286,7 @@ void ED_operatormacros_mesh(void)
 	WM_operator_pie_macro("VIEW3D_OT_edit_mesh_extrude_sticky", "Extrude Sticky",
 	                      "Extrude the mesh surface",
 	                      OPTYPE_UNDO | OPTYPE_REGISTER, "VIEW3D_OT_edit_mesh_extrude_move_normal",  /* python operator */
-	                      "VIEW3D_MT_edit_mesh_extrude");
+	                      "VIEW3D_MT_edit_mesh_extrude_pie");
 }
 
 /* note mesh keymap also for other space? */
@@ -364,6 +364,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "inside", true);
 	
+	WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0);
 	WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_sticky", EKEY, KM_PRESS, 0, 0);
 	
 	WM_keymap_add_item(keymap, "TRANSFORM_OT_edge_crease", EKEY, KM_PRESS, KM_SHIFT, 0);




More information about the Bf-blender-cvs mailing list