forked from bartvdbraak/blender
- Extrude Menu call "extrude regions along normals" for Region option
- Extrude Menu not longer restricted by selection mode, only selection totals (will show all possible options for the selection, regardless of selection mode) - Missing operator descriptions
This commit is contained in:
parent
5d9fcfb3ec
commit
36520e20c7
@ -1216,37 +1216,49 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
|
||||
totedge = mesh.total_edge_sel
|
||||
totvert = mesh.total_vert_sel
|
||||
|
||||
if selection_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 selection_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 selection_mode[2]: # face
|
||||
if totface == 0:
|
||||
return ()
|
||||
elif totface == 1:
|
||||
return (0,)
|
||||
else:
|
||||
return (0, 1)
|
||||
# the following is dependent on selection modes
|
||||
# we don't really want that
|
||||
# if selection_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 selection_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 selection_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 ()
|
||||
@ -1255,10 +1267,17 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
region_menu = lambda: layout.operator("mesh.extrude_region_move", text="Region")
|
||||
face_menu = lambda: layout.operator("mesh.extrude_faces_move", text="Individual Faces")
|
||||
edge_menu = lambda: layout.operator("mesh.extrude_edges_move", text="Edges Only")
|
||||
vert_menu = lambda: layout.operator("mesh.extrude_vertices_move", text="Vertices Only")
|
||||
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
|
||||
|
||||
@ -1267,6 +1286,7 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
|
||||
func()
|
||||
|
||||
class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
|
||||
"Extrude individual elements and move"
|
||||
bl_label = "Extrude Individual and Move"
|
||||
bl_idname = "view3d.edit_mesh_extrude_individual_move"
|
||||
|
||||
@ -1291,8 +1311,9 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
|
||||
return self.execute(context)
|
||||
|
||||
class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
|
||||
bl_label = "Extrude and Move"
|
||||
bl_idname = "view3d.edit_mesh_extrude_move"
|
||||
"Extrude and move along normals"
|
||||
bl_label = "Extrude and Move on Normals"
|
||||
bl_idname = "view3d.edit_mesh_extrude_move_normal"
|
||||
|
||||
def execute(self, context):
|
||||
mesh = context.object.data
|
||||
|
@ -174,38 +174,45 @@ void ED_operatormacros_mesh(void)
|
||||
wmOperatorTypeMacro *otmacro;
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
ot->description = "Cut mesh loop and slide it";
|
||||
WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
|
||||
WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
ot->description = "Duplicate mesh and move";
|
||||
WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
ot->description = "Rip polygons and move the result";
|
||||
WM_operatortype_macro_define(ot, "MESH_OT_rip");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
ot->description = "Extrude region and move result";
|
||||
otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
|
||||
RNA_enum_set(otmacro->ptr, "type", 1);
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
ot->description = "Extrude faces and move result";
|
||||
otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
|
||||
RNA_enum_set(otmacro->ptr, "type", 2);
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
ot->description = "Extrude edges and move result";
|
||||
otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
|
||||
RNA_enum_set(otmacro->ptr, "type", 3);
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
ot->description = "Extrude vertices and move result";
|
||||
otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
|
||||
RNA_enum_set(otmacro->ptr, "type", 4);
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
@ -261,7 +268,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
|
||||
WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1);
|
||||
|
||||
WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move", EKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "view3d.edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_individual_move", EKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user