Interface:
* Move the "Add" menu from the Info header into the 3D View header. Patch by Andrew Buttery (axb), with small tweaks by myself. (Patch ID #37241). Approved by Brecht and Jonathan.
This commit is contained in:
@@ -37,7 +37,6 @@ class INFO_HT_header(Header):
|
||||
if context.area.show_menus:
|
||||
sub = row.row(align=True)
|
||||
sub.menu("INFO_MT_file")
|
||||
sub.menu("INFO_MT_add")
|
||||
if rd.use_game_engine:
|
||||
sub.menu("INFO_MT_game")
|
||||
else:
|
||||
@@ -199,131 +198,6 @@ class INFO_MT_file_external_data(Menu):
|
||||
layout.operator("file.find_missing_files")
|
||||
|
||||
|
||||
class INFO_MT_mesh_add(Menu):
|
||||
bl_idname = "INFO_MT_mesh_add"
|
||||
bl_label = "Mesh"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
|
||||
layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
|
||||
layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
|
||||
layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
|
||||
layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
|
||||
layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text="Cylinder")
|
||||
layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
|
||||
layout.separator()
|
||||
layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
|
||||
layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
|
||||
layout.operator("mesh.primitive_torus_add", icon='MESH_TORUS', text="Torus")
|
||||
|
||||
|
||||
class INFO_MT_curve_add(Menu):
|
||||
bl_idname = "INFO_MT_curve_add"
|
||||
bl_label = "Curve"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
|
||||
layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
|
||||
layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text="Nurbs Curve")
|
||||
layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
|
||||
layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
|
||||
|
||||
|
||||
class INFO_MT_surface_add(Menu):
|
||||
bl_idname = "INFO_MT_surface_add"
|
||||
bl_label = "Surface"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
|
||||
layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
|
||||
layout.operator("surface.primitive_nurbs_surface_surface_add", icon='SURFACE_NSURFACE', text="NURBS Surface")
|
||||
layout.operator("surface.primitive_nurbs_surface_cylinder_add", icon='SURFACE_NCYLINDER', text="NURBS Cylinder")
|
||||
layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
|
||||
layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
|
||||
|
||||
|
||||
class INFO_MT_edit_curve_add(Menu):
|
||||
bl_idname = "INFO_MT_edit_curve_add"
|
||||
bl_label = "Add"
|
||||
|
||||
def draw(self, context):
|
||||
is_surf = context.active_object.type == 'SURFACE'
|
||||
|
||||
layout = self.layout
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
|
||||
if is_surf:
|
||||
INFO_MT_surface_add.draw(self, context)
|
||||
else:
|
||||
INFO_MT_curve_add.draw(self, context)
|
||||
|
||||
|
||||
class INFO_MT_armature_add(Menu):
|
||||
bl_idname = "INFO_MT_armature_add"
|
||||
bl_label = "Armature"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
|
||||
|
||||
|
||||
class INFO_MT_add(Menu):
|
||||
bl_label = "Add"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
# note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
|
||||
|
||||
# Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
|
||||
# "align_view" to work on first call (see [#32719]).
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
|
||||
#layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
|
||||
layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
|
||||
|
||||
#layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
|
||||
layout.menu("INFO_MT_curve_add", icon='OUTLINER_OB_CURVE')
|
||||
#layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
|
||||
layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator_menu_enum("object.metaball_add", "type", text="Metaball", icon='OUTLINER_OB_META')
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
|
||||
layout.separator()
|
||||
|
||||
layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
|
||||
layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
|
||||
layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
|
||||
layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP')
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
|
||||
layout.separator()
|
||||
|
||||
if len(bpy.data.groups) > 10:
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
|
||||
else:
|
||||
layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')
|
||||
|
||||
|
||||
class INFO_MT_game(Menu):
|
||||
bl_label = "Game"
|
||||
|
@@ -54,6 +54,9 @@ class VIEW3D_HT_header(Header):
|
||||
elif mode_string not in {'EDIT_TEXT', 'SCULPT'}:
|
||||
sub.menu("VIEW3D_MT_select_%s" % mode_string.lower())
|
||||
|
||||
if mode_string in {'OBJECT', 'EDIT_MESH', 'EDIT_CURVE', 'EDIT_SURFACE', 'EDIT_METABALL'}:
|
||||
sub.menu("INFO_MT_add")
|
||||
|
||||
if edit_object:
|
||||
sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
|
||||
elif obj:
|
||||
@@ -132,6 +135,7 @@ class VIEW3D_HT_header(Header):
|
||||
|
||||
# ********** Menu **********
|
||||
|
||||
|
||||
# ********** Utilities **********
|
||||
|
||||
|
||||
@@ -816,6 +820,135 @@ class VIEW3D_MT_select_paint_mask_vertex(Menu):
|
||||
|
||||
layout.operator("paint.vert_select_ungrouped", text="Ungrouped Verts")
|
||||
|
||||
# ********** Add menu **********
|
||||
|
||||
# XXX: INFO_MT_ names used to keep backwards compatibility (Addons etc that hook into the menu)
|
||||
|
||||
class INFO_MT_mesh_add(Menu):
|
||||
bl_idname = "INFO_MT_mesh_add"
|
||||
bl_label = "Mesh"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
|
||||
layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
|
||||
layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
|
||||
layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
|
||||
layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
|
||||
layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text="Cylinder")
|
||||
layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
|
||||
layout.separator()
|
||||
layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
|
||||
layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
|
||||
layout.operator("mesh.primitive_torus_add", icon='MESH_TORUS', text="Torus")
|
||||
|
||||
|
||||
class INFO_MT_curve_add(Menu):
|
||||
bl_idname = "INFO_MT_curve_add"
|
||||
bl_label = "Curve"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
|
||||
layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
|
||||
layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text="Nurbs Curve")
|
||||
layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
|
||||
layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
|
||||
|
||||
|
||||
class INFO_MT_surface_add(Menu):
|
||||
bl_idname = "INFO_MT_surface_add"
|
||||
bl_label = "Surface"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
|
||||
layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
|
||||
layout.operator("surface.primitive_nurbs_surface_surface_add", icon='SURFACE_NSURFACE', text="NURBS Surface")
|
||||
layout.operator("surface.primitive_nurbs_surface_cylinder_add", icon='SURFACE_NCYLINDER', text="NURBS Cylinder")
|
||||
layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
|
||||
layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
|
||||
|
||||
|
||||
class INFO_MT_edit_curve_add(Menu):
|
||||
bl_idname = "INFO_MT_edit_curve_add"
|
||||
bl_label = "Add"
|
||||
|
||||
def draw(self, context):
|
||||
is_surf = context.active_object.type == 'SURFACE'
|
||||
|
||||
layout = self.layout
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
|
||||
if is_surf:
|
||||
INFO_MT_surface_add.draw(self, context)
|
||||
else:
|
||||
INFO_MT_curve_add.draw(self, context)
|
||||
|
||||
|
||||
class INFO_MT_armature_add(Menu):
|
||||
bl_idname = "INFO_MT_armature_add"
|
||||
bl_label = "Armature"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
|
||||
|
||||
|
||||
class INFO_MT_add(Menu):
|
||||
bl_label = "Add"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
# note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
|
||||
|
||||
# Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
|
||||
# "align_view" to work on first call (see [#32719]).
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
|
||||
#layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
|
||||
layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
|
||||
|
||||
#layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
|
||||
layout.menu("INFO_MT_curve_add", icon='OUTLINER_OB_CURVE')
|
||||
#layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
|
||||
layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator_menu_enum("object.metaball_add", "type", text="Metaball", icon='OUTLINER_OB_META')
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
|
||||
layout.separator()
|
||||
|
||||
layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
|
||||
layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
|
||||
layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
|
||||
layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP')
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
|
||||
layout.separator()
|
||||
|
||||
if len(bpy.data.groups) > 10:
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
|
||||
else:
|
||||
layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')
|
||||
|
||||
|
||||
# ********** Object menu **********
|
||||
|
||||
|
Reference in New Issue
Block a user