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

This commit is contained in:
Campbell Barton 2010-10-11 02:05:44 +00:00
parent 4ad2e4a383
commit db4a205fa0

@ -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):