Topbar: remove info editor menus, rename topbar menus for script compatibility.

We can still rename them later, but avoid breaking stuff for now.
This commit is contained in:
Brecht Van Lommel 2018-04-21 10:28:27 +02:00
parent e89fefdc69
commit 0f2b4cb68a
2 changed files with 39 additions and 355 deletions

View File

@ -26,329 +26,13 @@ class INFO_HT_header(Header):
def draw(self, context):
layout = self.layout
layout.template_header()
window = context.window
workspace = context.workspace
screen = context.screen
scene = context.scene
layer = context.view_layer
row = layout.row(align=True)
row.template_header()
INFO_MT_editor_menus.draw_collapsible(context, layout)
layout.separator()
if screen.show_fullscreen:
layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous")
layout.separator()
else:
layout.template_ID(window, "workspace", new="workspace.workspace_add_menu", unlink="workspace.workspace_delete")
layout.template_search_preview(window, "screen", workspace, "screens", new="screen.new", unlink="screen.delete", rows=2, cols=6)
if layer.objects.active:
act_mode_item = bpy.types.Object.bl_rna.properties["mode"].enum_items[layer.objects.active.mode]
layout.operator_menu_enum("object.mode_set", "mode", text=act_mode_item.name, icon=act_mode_item.icon)
row = layout.row()
row.active = not workspace.use_scene_settings
# Active workspace view-layer is retrieved through window, not through workspace.
row.template_search(window, "view_layer", scene, "view_layers")
layout.separator()
layout.template_ID(window, "scene", new="scene.new", unlink="scene.delete")
layout.separator()
layout.template_running_jobs()
layout.template_reports_banner()
row = layout.row(align=True)
if bpy.app.autoexec_fail is True and bpy.app.autoexec_fail_quiet is False:
row.label("Auto-run disabled", icon='ERROR')
if bpy.data.is_saved:
props = row.operator("wm.revert_mainfile", icon='SCREEN_BACK', text="Reload Trusted")
props.use_scripts = True
row.operator("script.autoexec_warn_clear", text="Ignore")
# include last so text doesn't push buttons out of the header
row.label(bpy.app.autoexec_fail_message)
return
row.operator("wm.splash", text="", icon='BLENDER', emboss=False)
row.label(text=scene.statistics(context.view_layer), translate=False)
class INFO_MT_editor_menus(Menu):
bl_idname = "INFO_MT_editor_menus"
bl_label = ""
def draw(self, context):
self.draw_menus(self.layout, context)
@staticmethod
def draw_menus(layout, context):
layout.menu("INFO_MT_file")
layout.menu("INFO_MT_render")
layout.menu("INFO_MT_window")
layout.menu("INFO_MT_help")
class INFO_MT_file(Menu):
bl_label = "File"
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.read_homefile", text="New", icon='NEW')
layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
layout.menu("INFO_MT_file_open_recent", icon='OPEN_RECENT')
layout.operator("wm.revert_mainfile", icon='FILE_REFRESH')
layout.operator("wm.recover_last_session", icon='RECOVER_LAST')
layout.operator("wm.recover_auto_save", text="Recover Auto Save...", icon='RECOVER_AUTO')
layout.separator()
layout.operator_context = 'EXEC_AREA' if context.blend_data.is_saved else 'INVOKE_AREA'
layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK')
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.save_as_mainfile", text="Save As...", icon='SAVE_AS')
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.save_as_mainfile", text="Save Copy...", icon='SAVE_COPY').copy = True
layout.separator()
layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES')
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.save_homefile", icon='SAVE_PREFS')
layout.operator("wm.read_factory_settings", icon='LOAD_FACTORY')
if any(bpy.utils.app_template_paths()):
app_template = context.user_preferences.app_template
if app_template:
layout.operator(
"wm.read_factory_settings",
text="Load Factory Template Settings",
icon='LOAD_FACTORY',
).app_template = app_template
del app_template
layout.menu("USERPREF_MT_app_templates", icon='FILE_BLEND')
layout.separator()
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.link", text="Link", icon='LINK_BLEND')
layout.operator("wm.append", text="Append", icon='APPEND_BLEND')
layout.menu("INFO_MT_file_previews")
layout.separator()
layout.menu("INFO_MT_file_import", icon='IMPORT')
layout.menu("INFO_MT_file_export", icon='EXPORT')
layout.separator()
layout.menu("INFO_MT_file_external_data", icon='EXTERNAL_DATA')
layout.operator("wm.blend_strings_utf8_validate", icon='FILE_BLEND')
layout.separator()
layout.operator_context = 'EXEC_AREA'
if bpy.data.is_dirty and context.user_preferences.view.use_quit_dialog:
layout.operator_context = 'INVOKE_SCREEN' # quit dialog
layout.operator("wm.quit_blender", text="Quit", icon='QUIT')
class INFO_MT_file_import(Menu):
bl_idname = "INFO_MT_file_import"
bl_label = "Import"
def draw(self, context):
if bpy.app.build_options.collada:
self.layout.operator("wm.collada_import", text="Collada (Default) (.dae)")
if bpy.app.build_options.alembic:
self.layout.operator("wm.alembic_import", text="Alembic (.abc)")
class INFO_MT_file_export(Menu):
bl_idname = "INFO_MT_file_export"
bl_label = "Export"
def draw(self, context):
if bpy.app.build_options.collada:
self.layout.operator("wm.collada_export", text="Collada (Default) (.dae)")
if bpy.app.build_options.alembic:
self.layout.operator("wm.alembic_export", text="Alembic (.abc)")
class INFO_MT_file_external_data(Menu):
bl_label = "External Data"
def draw(self, context):
layout = self.layout
icon = 'CHECKBOX_HLT' if bpy.data.use_autopack else 'CHECKBOX_DEHLT'
layout.operator("file.autopack_toggle", icon=icon)
layout.separator()
pack_all = layout.row()
pack_all.operator("file.pack_all")
pack_all.active = not bpy.data.use_autopack
unpack_all = layout.row()
unpack_all.operator("file.unpack_all")
unpack_all.active = not bpy.data.use_autopack
layout.separator()
layout.operator("file.make_paths_relative")
layout.operator("file.make_paths_absolute")
layout.operator("file.report_missing_files")
layout.operator("file.find_missing_files")
class INFO_MT_file_previews(Menu):
bl_label = "Data Previews"
def draw(self, context):
layout = self.layout
layout.operator("wm.previews_ensure")
layout.operator("wm.previews_batch_generate")
layout.separator()
layout.operator("wm.previews_clear")
layout.operator("wm.previews_batch_clear")
class INFO_MT_render(Menu):
bl_label = "Render"
def draw(self, context):
layout = self.layout
layout.operator("render.render", text="Render Image", icon='RENDER_STILL').use_viewport = True
props = layout.operator("render.render", text="Render Animation", icon='RENDER_ANIMATION')
props.animation = True
props.use_viewport = True
layout.separator()
layout.operator("render.opengl", text="OpenGL Render Image")
layout.operator("render.opengl", text="OpenGL Render Animation").animation = True
layout.menu("INFO_MT_opengl_render")
layout.separator()
layout.operator("render.view_show")
layout.operator("render.play_rendered_anim", icon='PLAY')
class INFO_MT_opengl_render(Menu):
bl_label = "OpenGL Render Options"
def draw(self, context):
layout = self.layout
rd = context.scene.render
layout.prop(rd, "use_antialiasing")
layout.prop(rd, "use_full_sample")
layout.prop_menu_enum(rd, "antialiasing_samples")
layout.prop_menu_enum(rd, "alpha_mode")
class INFO_MT_window(Menu):
bl_label = "Window"
def draw(self, context):
import sys
layout = self.layout
layout.operator("wm.window_new")
layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER')
layout.separator()
layout.operator("screen.screenshot")
layout.operator("screen.screencast")
if sys.platform[:3] == "win":
layout.separator()
layout.operator("wm.console_toggle", icon='CONSOLE')
if context.scene.render.use_multiview:
layout.separator()
layout.operator("wm.set_stereo_3d", icon='CAMERA_STEREO')
class INFO_MT_help(Menu):
bl_label = "Help"
def draw(self, context):
layout = self.layout
layout.operator(
"wm.url_open", text="Manual", icon='HELP',
).url = "https://docs.blender.org/manual/en/dev/"
layout.operator(
"wm.url_open", text="Release Log", icon='URL',
).url = "http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/%d.%d" % bpy.app.version[:2]
layout.separator()
layout.operator(
"wm.url_open", text="Blender Website", icon='URL',
).url = "https://www.blender.org"
layout.operator(
"wm.url_open", text="Blender Store", icon='URL',
).url = "https://store.blender.org"
layout.operator(
"wm.url_open", text="Developer Community", icon='URL',
).url = "https://www.blender.org/get-involved/"
layout.operator(
"wm.url_open", text="User Community", icon='URL',
).url = "https://www.blender.org/support/user-community"
layout.separator()
layout.operator(
"wm.url_open", text="Report a Bug", icon='URL',
).url = "https://developer.blender.org/maniphest/task/edit/form/1"
layout.separator()
layout.operator(
"wm.url_open", text="Python API Reference", icon='URL',
).url = bpy.types.WM_OT_doc_view._prefix
layout.operator("wm.operator_cheat_sheet", icon='TEXT')
layout.operator("wm.sysinfo", icon='TEXT')
layout.separator()
layout.operator("wm.splash", icon='BLENDER')
# Empty for now until info editor gets turned into log editor
pass
classes = (
INFO_HT_header,
INFO_MT_editor_menus,
INFO_MT_file,
INFO_MT_file_import,
INFO_MT_file_export,
INFO_MT_file_external_data,
INFO_MT_file_previews,
INFO_MT_render,
INFO_MT_opengl_render,
INFO_MT_window,
INFO_MT_help,
)
if __name__ == "__main__": # only for live edit.

View File

@ -40,7 +40,7 @@ class TOPBAR_HT_upper_bar(Header):
layout.operator("wm.splash", text="", icon='BLENDER', emboss=False)
TOPBAR_MT_editor_menus.draw_collapsible(context, layout)
INFO_MT_editor_menus.draw_collapsible(context, layout)
layout.separator()
@ -112,8 +112,8 @@ class TOPBAR_HT_lower_bar(Header):
layout.operator("ed.undo_history", text="...")
class TOPBAR_MT_editor_menus(Menu):
bl_idname = "TOPBAR_MT_editor_menus"
class INFO_MT_editor_menus(Menu):
bl_idname = "INFO_MT_editor_menus"
bl_label = ""
def draw(self, context):
@ -121,15 +121,15 @@ class TOPBAR_MT_editor_menus(Menu):
@staticmethod
def draw_menus(layout, context):
layout.menu("TOPBAR_MT_file")
layout.menu("INFO_MT_file")
layout.menu("TOPBAR_MT_render")
layout.menu("INFO_MT_render")
layout.menu("TOPBAR_MT_window")
layout.menu("TOPBAR_MT_help")
layout.menu("INFO_MT_window")
layout.menu("INFO_MT_help")
class TOPBAR_MT_file(Menu):
class INFO_MT_file(Menu):
bl_label = "File"
def draw(self, context):
@ -138,7 +138,7 @@ class TOPBAR_MT_file(Menu):
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.read_homefile", text="New", icon='NEW')
layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
layout.menu("TOPBAR_MT_file_open_recent", icon='OPEN_RECENT')
layout.menu("INFO_MT_file_open_recent", icon='OPEN_RECENT')
layout.operator("wm.revert_mainfile", icon='FILE_REFRESH')
layout.operator("wm.recover_last_session", icon='RECOVER_LAST')
layout.operator("wm.recover_auto_save", text="Recover Auto Save...", icon='RECOVER_AUTO')
@ -166,16 +166,16 @@ class TOPBAR_MT_file(Menu):
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.link", text="Link", icon='LINK_BLEND')
layout.operator("wm.append", text="Append", icon='APPEND_BLEND')
layout.menu("TOPBAR_MT_file_previews")
layout.menu("INFO_MT_file_previews")
layout.separator()
layout.menu("TOPBAR_MT_file_import", icon='IMPORT')
layout.menu("TOPBAR_MT_file_export", icon='EXPORT')
layout.menu("INFO_MT_file_import", icon='IMPORT')
layout.menu("INFO_MT_file_export", icon='EXPORT')
layout.separator()
layout.menu("TOPBAR_MT_file_external_data", icon='EXTERNAL_DATA')
layout.menu("INFO_MT_file_external_data", icon='EXTERNAL_DATA')
layout.separator()
@ -185,8 +185,8 @@ class TOPBAR_MT_file(Menu):
layout.operator("wm.quit_blender", text="Quit", icon='QUIT')
class TOPBAR_MT_file_import(Menu):
bl_idname = "TOPBAR_MT_file_import"
class INFO_MT_file_import(Menu):
bl_idname = "INFO_MT_file_import"
bl_label = "Import"
def draw(self, context):
@ -196,8 +196,8 @@ class TOPBAR_MT_file_import(Menu):
self.layout.operator("wm.alembic_import", text="Alembic (.abc)")
class TOPBAR_MT_file_export(Menu):
bl_idname = "TOPBAR_MT_file_export"
class INFO_MT_file_export(Menu):
bl_idname = "INFO_MT_file_export"
bl_label = "Export"
def draw(self, context):
@ -207,7 +207,7 @@ class TOPBAR_MT_file_export(Menu):
self.layout.operator("wm.alembic_export", text="Alembic (.abc)")
class TOPBAR_MT_file_external_data(Menu):
class INFO_MT_file_external_data(Menu):
bl_label = "External Data"
def draw(self, context):
@ -234,7 +234,7 @@ class TOPBAR_MT_file_external_data(Menu):
layout.operator("file.find_missing_files")
class TOPBAR_MT_file_previews(Menu):
class INFO_MT_file_previews(Menu):
bl_label = "Data Previews"
def draw(self, context):
@ -249,7 +249,7 @@ class TOPBAR_MT_file_previews(Menu):
layout.operator("wm.previews_batch_clear")
class TOPBAR_MT_game(Menu):
class INFO_MT_game(Menu):
bl_label = "Game"
def draw(self, context):
@ -270,7 +270,7 @@ class TOPBAR_MT_game(Menu):
layout.prop(gs, "use_auto_start")
class TOPBAR_MT_render(Menu):
class INFO_MT_render(Menu):
bl_label = "Render"
def draw(self, context):
@ -285,7 +285,7 @@ class TOPBAR_MT_render(Menu):
layout.operator("render.opengl", text="OpenGL Render Image")
layout.operator("render.opengl", text="OpenGL Render Animation").animation = True
layout.menu("TOPBAR_MT_opengl_render")
layout.menu("INFO_MT_opengl_render")
layout.separator()
@ -293,7 +293,7 @@ class TOPBAR_MT_render(Menu):
layout.operator("render.play_rendered_anim", icon='PLAY')
class TOPBAR_MT_opengl_render(Menu):
class INFO_MT_opengl_render(Menu):
bl_label = "OpenGL Render Options"
def draw(self, context):
@ -307,7 +307,7 @@ class TOPBAR_MT_opengl_render(Menu):
layout.prop_menu_enum(rd, "alpha_mode")
class TOPBAR_MT_window(Menu):
class INFO_MT_window(Menu):
bl_label = "Window"
def draw(self, context):
@ -332,7 +332,7 @@ class TOPBAR_MT_window(Menu):
layout.operator("wm.set_stereo_3d", icon='CAMERA_STEREO')
class TOPBAR_MT_help(Menu):
class INFO_MT_help(Menu):
bl_label = "Help"
def draw(self, context):
@ -378,17 +378,17 @@ class TOPBAR_MT_help(Menu):
classes = (
TOPBAR_HT_upper_bar,
TOPBAR_HT_lower_bar,
TOPBAR_MT_editor_menus,
TOPBAR_MT_file,
TOPBAR_MT_file_import,
TOPBAR_MT_file_export,
TOPBAR_MT_file_external_data,
TOPBAR_MT_file_previews,
TOPBAR_MT_game,
TOPBAR_MT_render,
TOPBAR_MT_opengl_render,
TOPBAR_MT_window,
TOPBAR_MT_help,
INFO_MT_editor_menus,
INFO_MT_file,
INFO_MT_file_import,
INFO_MT_file_export,
INFO_MT_file_external_data,
INFO_MT_file_previews,
INFO_MT_game,
INFO_MT_render,
INFO_MT_opengl_render,
INFO_MT_window,
INFO_MT_help,
)
if __name__ == "__main__": # only for live edit.