[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32405] trunk/blender/release/scripts/ui/ space_view3d.py: bugfix [#24190] Extrude Faces called from Alt+ E_key menu don't works well

Campbell Barton ideasman42 at gmail.com
Mon Oct 11 04:05:46 CEST 2010


Revision: 32405
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32405
Author:   campbellbarton
Date:     2010-10-11 04:05:44 +0200 (Mon, 11 Oct 2010)

Log Message:
-----------
bugfix [#24190] Extrude Faces called from Alt+ E_key menu don't works well

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_view3d.py

Modified: trunk/blender/release/scripts/ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d.py	2010-10-11 00:15:49 UTC (rev 32404)
+++ trunk/blender/release/scripts/ui/space_view3d.py	2010-10-11 02:05:44 UTC (rev 32405)
@@ -1394,84 +1394,37 @@
 class VIEW3D_MT_edit_mesh_extrude(bpy.types.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"),
+    }
+
     @staticmethod
     def extrude_options(context):
         mesh = context.object.data
         select_mode = context.tool_settings.mesh_select_mode
 
-        totface = mesh.total_face_sel
-        totedge = mesh.total_edge_sel
-        totvert = mesh.total_vert_sel
+        menu = []
+        if mesh.total_face_sel:
+            menu += ["REGION", "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"]        
 
-        # the following is dependent on selection modes
-        # we don't really want that
-#        if select_mode[0]: # vert
-#            if totvert == 0:
-#                return ()
-#            elif totvert == 1:
-#                return (3,)
-#            elif totedge == 0:
-#                return (3,)
-#            elif totface == 0:
-#                return (2, 3)
-#            elif totface == 1:
-#                return (0, 2, 3)
-#            else:
-#                return (0, 1, 2, 3)
-#        elif select_mode[1]: # edge
-#            if totedge == 0:
-#                return ()
-#            elif totedge == 1:
-#                return (2,)
-#            elif totface == 0:
-#                return (2,)
-#            elif totface == 1:
-#                return (0, 2)
-#            else:
-#                return (0, 1, 2)
-#        elif select_mode[2]: # face
-#            if totface == 0:
-#                return ()
-#            elif totface == 1:
-#                return (0,)
-#            else:
-#                return (0, 1)
-
-        if totvert == 0:
-            return ()
-        elif totedge == 0:
-            return (0, 3)
-        elif totface == 0:
-            return (0, 2, 3)
-        else:
-            return (0, 1, 2, 3)
-
         # should never get here
-        return ()
+        return menu
 
     def draw(self, context):
         layout = self.layout
         layout.operator_context = 'INVOKE_REGION_WIN'
 
-        def region_menu():
-            layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region")
+        for menu_id in self.extrude_options(context):
+            self._extrude_funcs[menu_id](layout)
 
-        def face_menu():
-            layout.operator("mesh.extrude_faces_move", text="Individual Faces")
 
-        def edge_menu():
-            layout.operator("mesh.extrude_edges_move", text="Edges Only")
-
-        def vert_menu():
-            layout.operator("mesh.extrude_vertices_move", text="Vertices Only")
-
-        menu_funcs = region_menu, face_menu, edge_menu, vert_menu
-
-        for i in self.extrude_options(context):
-            func = menu_funcs[i]
-            func()
-
-
 class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
     "Extrude individual elements and move"
     bl_label = "Extrude Individual and Move"





More information about the Bf-blender-cvs mailing list