diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-11 06:05:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-11 06:05:44 +0400 |
commit | db4a205fa0343f03eae4020f1beb3dcea4469337 (patch) | |
tree | 31a5dafb055796c6b9d59355d15000082bbdbe21 | |
parent | 4ad2e4a3830535d62aadd035bd5a714bca20a816 (diff) |
bugfix [#24190] Extrude Faces called from Alt+ E_key menu don't works well
-rw-r--r-- | release/scripts/ui/space_view3d.py | 81 |
1 files changed, 17 insertions, 64 deletions
diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 5bd809fea7e..9299362cc05 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -1394,82 +1394,35 @@ class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu): 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 - - # 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) + 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"] # 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") - - 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() + for menu_id in self.extrude_options(context): + self._extrude_funcs[menu_id](layout) class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator): |