2.5: Top Menu

* Clean up File menu, added back recover last session op.
* .blend compress now behaves a bit different, previously
  it would only respect the user preference. Now it saves
  existing files the same way they are saved, and new files
  following the user preference. The save operator has a
  Compress toggle in the file browser left panels now.

* Add menu working again, some fixes to make these operators
  work outside the 3d view were needed.
* Timeline menu removed, its contents will be moved to the
  timeline header menus.
* Game menu can now start game, changed the start game op
  to choose another 3d view if none is available.
* Render menu has a few items now.
* Help menu contains a few links again.
This commit is contained in:
Brecht Van Lommel
2009-07-23 21:35:11 +00:00
parent 0bb50594f9
commit 1ee8038e41
11 changed files with 273 additions and 59 deletions

View File

@@ -7,6 +7,7 @@ class INFO_HT_header(bpy.types.Header):
def draw(self, context):
st = context.space_data
rd = context.scene.render_data
layout = self.layout
layout.template_header()
@@ -15,7 +16,6 @@ class INFO_HT_header(bpy.types.Header):
row = layout.row()
row.itemM("INFO_MT_file")
row.itemM("INFO_MT_add")
row.itemM("INFO_MT_timeline")
row.itemM("INFO_MT_game")
row.itemM("INFO_MT_render")
row.itemM("INFO_MT_help")
@@ -36,21 +36,49 @@ class INFO_MT_file(bpy.types.Menu):
layout = self.layout
layout.operator_context = "EXEC_AREA"
layout.itemO("wm.read_homefile")
layout.itemO("wm.read_homefile", text="New")
layout.operator_context = "INVOKE_AREA"
layout.itemO("wm.open_mainfile")
layout.itemO("wm.open_mainfile", text="Open...")
layout.item_menu_enumO("wm.open_recentfile", "file", text="Open Recent")
layout.itemO("wm.recover_last_session")
layout.itemS()
layout.operator_context = "EXEC_AREA"
layout.itemO("wm.save_mainfile")
layout.itemO("wm.save_mainfile", text="Save")
layout.operator_context = "INVOKE_AREA"
layout.itemO("wm.save_as_mainfile")
layout.itemO("wm.save_as_mainfile", text="Save As...")
layout.itemS()
layout.itemM("INFO_MT_file_import")
layout.itemM("INFO_MT_file_export")
layout.itemS()
layout.itemM("INFO_MT_file_external_data")
layout.itemS()
layout.operator_context = "EXEC_AREA"
layout.itemO("wm.exit_blender", text="Quit")
class INFO_MT_file_import(bpy.types.Menu):
__space_type__ = "USER_PREFERENCES"
__label__ = "Import"
def draw(self, context):
layout = self.layout
class INFO_MT_file_export(bpy.types.Menu):
__space_type__ = "USER_PREFERENCES"
__label__ = "Export"
def draw(self, context):
layout = self.layout
layout.itemO("export.ply", text="PLY")
class INFO_MT_file_external_data(bpy.types.Menu):
__space_type__ = "USER_PREFERENCES"
__label__ = "External Data"
@@ -74,15 +102,25 @@ class INFO_MT_add(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemL(text="Nothing yet")
class INFO_MT_timeline(bpy.types.Menu):
__space_type__ = "USER_PREFERENCES"
__label__ = "Timeline"
layout.operator_context = "EXEC_SCREEN"
def draw(self, context):
layout = self.layout
layout.itemL(text="Nothing yet")
layout.item_menu_enumO( "OBJECT_OT_mesh_add", "type", text="Mesh", icon="ICON_OUTLINER_OB_MESH")
layout.item_menu_enumO( "OBJECT_OT_curve_add", "type", text="Curve", icon="ICON_OUTLINER_OB_CURVE")
layout.item_menu_enumO( "OBJECT_OT_surface_add", "type", text="Surface", icon="ICON_OUTLINER_OB_SURFACE")
layout.item_enumO("OBJECT_OT_object_add", "type", "META", icon="ICON_OUTLINER_OB_META")
layout.itemO("OBJECT_OT_text_add", text="Text", icon="ICON_OUTLINER_OB_FONT")
layout.itemS()
layout.itemO("OBJECT_OT_armature_add", text="Armature", icon="ICON_OUTLINER_OB_ARMATURE")
layout.item_enumO("OBJECT_OT_object_add", "type", "LATTICE", icon="ICON_OUTLINER_OB_LATTICE")
layout.item_enumO("OBJECT_OT_object_add", "type", "EMPTY", icon="ICON_OUTLINER_OB_EMPTY")
layout.itemS()
layout.item_enumO("OBJECT_OT_object_add", "type", "CAMERA", icon="ICON_OUTLINER_OB_CAMERA")
layout.item_enumO("OBJECT_OT_object_add", "type", "LAMP", icon="ICON_OUTLINER_OB_LAMP")
class INFO_MT_game(bpy.types.Menu):
__space_type__ = "USER_PREFERENCES"
@@ -90,7 +128,8 @@ class INFO_MT_game(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemL(text="Nothing yet")
layout.itemO("view3d.game_start")
class INFO_MT_render(bpy.types.Menu):
__space_type__ = "USER_PREFERENCES"
@@ -98,7 +137,14 @@ class INFO_MT_render(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemL(text="Nothing yet")
rd = context.scene.render_data
layout.itemO("screen.render", text="Render Image")
layout.item_booleanO("screen.render", "animation", True, text="Render Animation")
layout.itemS()
layout.itemO("screen.render_view_show")
class INFO_MT_help(bpy.types.Menu):
__space_type__ = "USER_PREFERENCES"
@@ -106,7 +152,16 @@ class INFO_MT_help(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.itemL(text="Nothing yet")
layout.itemO("help.manual")
layout.itemO("help.release_logs")
layout.itemS()
layout.itemO("help.blender_website")
layout.itemO("help.blender_eshop")
layout.itemO("help.developer_community")
layout.itemO("help.user_community")
class INFO_PT_tabs(bpy.types.Panel):
__space_type__ = "USER_PREFERENCES"
@@ -477,12 +532,12 @@ class INFO_PT_bottombar(bpy.types.Panel):
split.itemL(text="")
split.itemO("wm.save_homefile", text="Save As Default")
bpy.types.register(INFO_HT_header)
bpy.types.register(INFO_MT_file)
bpy.types.register(INFO_MT_file_import)
bpy.types.register(INFO_MT_file_export)
bpy.types.register(INFO_MT_file_external_data)
bpy.types.register(INFO_MT_add)
bpy.types.register(INFO_MT_timeline)
bpy.types.register(INFO_MT_game)
bpy.types.register(INFO_MT_render)
bpy.types.register(INFO_MT_help)
@@ -495,3 +550,57 @@ bpy.types.register(INFO_PT_autosave)
bpy.types.register(INFO_PT_language)
bpy.types.register(INFO_PT_bottombar)
# Help operators
import bpy_ops # XXX - should not need to do this
del bpy_ops
class HelpOperator(bpy.types.Operator):
def execute(self, context):
try: import webbrowser
except: webbrowser = None
if webbrowser:
webbrowser.open(self.__URL__)
else:
raise Exception("Operator requires a full Python installation")
return ('FINISHED',)
class HELP_OT_manual(HelpOperator):
__idname__ = "help.manual"
__label__ = "Manual"
__URL__ = 'http://wiki.blender.org/index.php/Manual'
class HELP_OT_release_logs(HelpOperator):
__idname__ = "help.release_logs"
__label__ = "Release Logs"
__URL__ = 'http://www.blender.org/development/release-logs/'
class HELP_OT_blender_website(HelpOperator):
__idname__ = "help.blender_website"
__label__ = "Blender Website"
__URL__ = 'http://www.blender.org/'
class HELP_OT_blender_eshop(HelpOperator):
__idname__ = "help.blender_eshop"
__label__ = "Blender e-Shop"
__URL__ = 'http://www.blender3d.org/e-shop'
class HELP_OT_developer_community(HelpOperator):
__idname__ = "help.developer_community"
__label__ = "Developer Community"
__URL__ = 'http://www.blender.org/community/get-involved/'
class HELP_OT_user_community(HelpOperator):
__idname__ = "help.user_community"
__label__ = "User Community"
__URL__ = 'http://www.blender.org/community/user-community/'
bpy.ops.add(HELP_OT_manual)
bpy.ops.add(HELP_OT_release_logs)
bpy.ops.add(HELP_OT_blender_website)
bpy.ops.add(HELP_OT_blender_eshop)
bpy.ops.add(HELP_OT_developer_community)
bpy.ops.add(HELP_OT_user_community)