diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-19 10:16:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-19 10:16:15 +0400 |
commit | 1968612e5b48299a0c03de807e242f36b41c68c8 (patch) | |
tree | e946b07b5c3ea88ddf10595ac870f54a7b2a5731 /release/scripts | |
parent | 4c42e73a9d398ccebb110d0c4cefc93e099fcfcb (diff) |
View3D: Add menu in the header is now context sensitive (like shift+a).
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 16cef7cf6fb..ec9c7ae9ffc 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -54,9 +54,17 @@ 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 mode_string == 'OBJECT': + sub.menu("INFO_MT_add", text="Add") + elif mode_string == 'EDIT_MESH': + sub.menu("INFO_MT_mesh_add", text="Add") + elif mode_string == 'EDIT_CURVE': + sub.menu("INFO_MT_curve_add", text="Add") + elif mode_string == 'EDIT_SURFACE': + sub.menu("INFO_MT_surface_add", text="Add") + elif mode_string == 'EDIT_METABALL': + sub.menu("INFO_MT_metaball_add", text="Add") + if edit_object: sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower()) elif obj: @@ -877,6 +885,17 @@ class INFO_MT_surface_add(Menu): layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus") +class INFO_MT_metaball_add(Menu): + bl_idname = "INFO_MT_metaball_add" + bl_label = "Metaball" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator_enum("object.metaball_add", "type") + + class INFO_MT_edit_curve_add(Menu): bl_idname = "INFO_MT_edit_curve_add" bl_label = "Add" @@ -923,9 +942,7 @@ class INFO_MT_add(Menu): 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.menu("INFO_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META') layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT') layout.separator() |