406 lines
18 KiB
Python
406 lines
18 KiB
Python
#!/usr/bin/env python -------------------------------- -*- coding: utf-8 -*-#
|
|
# 2023 3DMish <Mish7913@gmail.com> #
|
|
|
|
# ----- ##### BEGIN GPL LICENSE BLOCK ##### ----- #
|
|
# #
|
|
# This program is free software; you can redistribute it and/or #
|
|
# modify it under the terms of the GNU General Public License #
|
|
# as published by the Free Software Foundation; either version 2 #
|
|
# of the License, or (at your option) any later version. #
|
|
# #
|
|
# This program is distributed in the hope that it will be useful, #
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
# GNU General Public License for more details. #
|
|
# #
|
|
# ----- ##### END GPL LICENSE BLOCK ##### ----- #
|
|
|
|
import bpy, os, sys;
|
|
|
|
from bpy.types import Header, Menu;
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/");
|
|
|
|
from bpy_sys import (
|
|
q_register_class, q_unregister_class, get_prop, lc_cont_x, lc_space_separator,
|
|
r_unregister_class, r_register_class, ver_less, lc_scale, data_path, ver_more,
|
|
);
|
|
|
|
if ver_less(2,79,5):
|
|
bl_conf = {
|
|
"INFO_HT_header": None, "INFO_MT_editor_menus": None,
|
|
"INFO_MT_render": None, "INFO_MT_game": None,
|
|
"INFO_MT_window": None, "INFO_MT_help": None,
|
|
"INFO_MT_file": None,
|
|
}
|
|
else:
|
|
bl_conf = {
|
|
"INFO_HT_header": None, "INFO_MT_editor_menus": None,
|
|
"INFO_MT_area": None, "INFO_MT_view": None,
|
|
"INFO_MT_info": None, "INFO_MT_context_menu": None,
|
|
}
|
|
|
|
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(lc_menu, context):
|
|
if ver_more(2,79,5):
|
|
lc_menu.menu("INFO_MT_view");
|
|
lc_menu.menu("INFO_MT_info");
|
|
else:
|
|
lc_render = context.scene.render;
|
|
|
|
lc_menu.menu("INFO_MT_file");
|
|
lc_menu.menu("INFO_MT_edit");
|
|
|
|
if lc_render.use_game_engine:
|
|
lc_menu.menu("INFO_MT_game");
|
|
else:
|
|
lc_menu.menu("INFO_MT_render");
|
|
|
|
lc_menu.menu("INFO_MT_window");
|
|
lc_menu.menu("INFO_MT_help");
|
|
|
|
class INFO_HT_header (Header):
|
|
bl_space_type = 'INFO';
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
lc_main.template_header();
|
|
|
|
lc_menu = lc_cont_x(lc_main);
|
|
|
|
if ver_more(2,79,5):
|
|
if (getattr(context.area, "show_menus") == get_prop("info_compact")):
|
|
lc_menu.menu("INFO_MT_editor_menus", text="Menu");
|
|
else:
|
|
INFO_MT_editor_menus.draw_menus(lc_menu, context);
|
|
else:
|
|
if (context.area.spaces[0].show_report_info == False):
|
|
lc_render = context.scene.render;
|
|
|
|
if (getattr(context.area, "show_menus") == get_prop("info_compact")):
|
|
lc_cont_x(lc_main, 1.2).menu("INFO_MT_editor_menus", text="Menu", icon="BLENDER");
|
|
lc_menu_size = 105;
|
|
else:
|
|
INFO_MT_editor_menus.draw_menus(lc_menu, context);
|
|
lc_menu_size = 255;
|
|
|
|
# --------------
|
|
|
|
lc_tabs_size = 0; lc_btn_size = 36;
|
|
lc_tabs = lc_cont_x(lc_main);
|
|
#lc_tabs.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete");
|
|
|
|
if context.window.screen.show_fullscreen:
|
|
lc_tabs.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous");
|
|
lc_space_separator(lc_main, lc_menu_size+130, 450);
|
|
else:
|
|
for i, tab in enumerate(bpy.data.screens):
|
|
is_active = tab == context.window.screen;
|
|
if (is_active) and (i>0):
|
|
lc_cont_x(lc_tabs, 0.1).operator("wm.empty", text=" ");
|
|
lc_tabs_size += 3;
|
|
lc_cont_x(lc_tabs, active=is_active).operator("screen.select", text=tab.name).id = tab.name;
|
|
if (is_active): lc_tabs.operator("screen.delete", text="", icon="X");
|
|
if (is_active) and (i<(len(bpy.data.screens)-1)):
|
|
lc_cont_x(lc_tabs, 0.1).operator("wm.empty", text=" ");
|
|
lc_tabs_size += 3;
|
|
lc_tabs_size += (len(tab.name)*5.5) + lc_btn_size;
|
|
|
|
lc_tabs.separator();
|
|
lc_tabs.operator("screen.new", text="", icon="ZOOMIN", emboss=False);
|
|
lc_tabs_size += lc_btn_size;
|
|
|
|
lc_space_separator(lc_main, lc_menu_size+lc_tabs_size, 450);
|
|
|
|
lc_main.operator("wm.splash", text="", icon='BLENDER', emboss=False);
|
|
lc_main.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete");
|
|
|
|
lc_scale(lc_main, 0.6, y=0.65).prop(context.scene, "layers", text="");
|
|
|
|
if lc_render.has_multiple_engines:
|
|
lc_main.prop(lc_render, "engine", text="");
|
|
else:
|
|
lc_space_separator(lc_main, 33, len(context.scene.statistics())*5.5);
|
|
lc_main.label(text=context.scene.statistics(), translate=False);
|
|
lc_main.separator();
|
|
lc_main.prop(context.area.spaces[0], "show_report_info", text="Show Status Bar");
|
|
|
|
class INFO_MT_file (Menu):
|
|
bl_label = "File";
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
|
|
lc_main.operator_context = 'INVOKE_AREA';
|
|
lc_main.menu("INFO_MT_file_new", text="New", icon='NEW');
|
|
lc_main.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER');
|
|
lc_main.menu("INFO_MT_file_open_recent", icon='OPEN_RECENT');
|
|
lc_main.operator("wm.revert_mainfile", icon='FILE_REFRESH');
|
|
lc_main.menu("INFO_MT_file_recover", icon='RECOVER_LAST');
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator_context = 'EXEC_AREA' if context.blend_data.is_saved else 'INVOKE_AREA';
|
|
lc_main.operator("wm.save_mainfile", text="Save", icon='FILE_TICK');
|
|
lc_main.operator_context = 'INVOKE_AREA';
|
|
lc_main.operator("wm.save_as_mainfile", text="Save As...");
|
|
lc_main.operator_context = 'INVOKE_AREA';
|
|
lc_main.operator("wm.save_as_mainfile", text="Save Copy...").copy = True;
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator_context = 'INVOKE_AREA';
|
|
lc_main.operator("wm.link", text="Link...", icon='LINK_BLEND');
|
|
lc_main.operator("wm.append", text="Append...", icon='APPEND_BLEND');
|
|
lc_main.menu("INFO_MT_file_previews");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.menu("INFO_MT_file_import", icon='IMPORT');
|
|
lc_main.menu("INFO_MT_file_export", icon='EXPORT');
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.menu("USERPREF_MT_app_templates", icon='FILE_BLEND');
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.menu("INFO_MT_file_external_data", icon='EXTERNAL_DATA');
|
|
#lc_main.menu("TOPBAR_MT_file_cleanup");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.menu("INFO_MT_file_defaults");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("wm.quit_blender", text="Quit", icon='QUIT');
|
|
|
|
|
|
class INFO_MT_file_defaults (Menu):
|
|
bl_label = "Defaults";
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
|
|
lc_main.operator_context = 'INVOKE_AREA';
|
|
lc_main.operator("wm.save_homefile", icon='SAVE_PREFS');
|
|
lc_main.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:
|
|
lc_main.operator(
|
|
"wm.read_factory_settings",
|
|
text="Load Factory Template Settings",
|
|
icon='LOAD_FACTORY',
|
|
).app_template = app_template;
|
|
del app_template;
|
|
|
|
class INFO_MT_file_new (Menu):
|
|
bl_label = "New File";
|
|
|
|
@staticmethod
|
|
def draw_ex(lc_main, _context, *, use_splash=False, use_more=False):
|
|
lc_main.operator_context = 'INVOKE_AREA';
|
|
|
|
#lc_main.operator("wm.read_homefile", text="General", icon='NEW');
|
|
|
|
btn_props = lc_main.operator("wm.read_homefile", text="General", icon="NEW");
|
|
btn_props.filepath = data_path + "/templates/general_2-79.blend";
|
|
|
|
def draw(self, context):
|
|
self.draw_ex(self.layout, context);
|
|
|
|
class INFO_MT_file_recover (Menu):
|
|
bl_label = "Recover";
|
|
|
|
def draw(self, _context):
|
|
lc_main = self.layout;
|
|
|
|
lc_main.operator("wm.recover_last_session", text="Last Session", icon='RECOVER_LAST');
|
|
lc_main.operator("wm.recover_auto_save", text="Auto Save...", icon='RECOVER_AUTO');
|
|
|
|
class INFO_MT_edit (Menu):
|
|
bl_label = "Edit";
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
|
|
lc_main.operator("ed.undo");
|
|
lc_main.operator("ed.redo");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("ed.undo_history");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("screen.repeat_last");
|
|
lc_main.operator("screen.repeat_history", text="Repeat History...");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("screen.redo_last", text="Adjust Last Operation...");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("wm.search_menu", text="Menu Search...", icon='VIEWZOOM');
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("screen.userpref_show", text="Preferences...", icon='PREFERENCES');
|
|
|
|
class INFO_MT_game (Menu):
|
|
bl_label = "Game"
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
|
|
gs = context.scene.game_settings;
|
|
|
|
lc_main.operator("view3d.game_start", icon='PLAY');
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.prop(gs, "show_debug_properties");
|
|
lc_main.prop(gs, "show_framerate_profile");
|
|
lc_main.prop(gs, "show_physics_visualization");
|
|
lc_main.prop(gs, "use_deprecation_warnings");
|
|
lc_main.prop(gs, "use_animation_record");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.prop(gs, "use_auto_start");
|
|
|
|
class INFO_MT_render (Menu):
|
|
bl_label = "Render";
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
|
|
lc_main.operator("render.render", text="Render Image", icon='RENDER_STILL').use_viewport = True;
|
|
btn_props = lc_main.operator("render.render", text="Render Animation", icon='RENDER_ANIMATION');
|
|
btn_props.animation = True; btn_props.use_viewport = True;
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("sound.mixdown", text="Mixdown Audio and Save", icon='SPEAKER');
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("render.opengl", text="OpenGL Render Image");
|
|
lc_main.operator("render.opengl", text="OpenGL Render Animation").animation = True;
|
|
lc_main.menu("INFO_MT_opengl_render");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("render.view_show");
|
|
lc_main.operator("render.play_rendered_anim", icon='PLAY');
|
|
|
|
class INFO_MT_window (Menu):
|
|
bl_label = "Window";
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
|
|
lc_main.operator("wm.window_duplicate");
|
|
lc_main.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER');
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.prop(context.area, "show_menus", text="Compact Menu" if get_prop("info_compact") else "Extended Menu");
|
|
lc_main.prop(context.area.spaces[0], "show_report_info", text="Show Status Bar");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("screen.screenshot");
|
|
lc_main.operator("screen.screencast");
|
|
|
|
if sys.platform[:3] == "win":
|
|
lc_main.separator();
|
|
lc_main.operator("wm.console_toggle", icon='CONSOLE');
|
|
|
|
if context.scene.render.use_multiview:
|
|
lc_main.separator();
|
|
lc_main.operator("wm.set_stereo_3d", icon='CAMERA_STEREO');
|
|
|
|
|
|
class INFO_MT_help (Menu):
|
|
bl_label = "Help";
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
|
|
lc_main.operator("wm.url_open", text="Manual", icon='HELP').url = "https://docs.blender.org/manual/en/dev/";
|
|
lc_main.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];
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("wm.url_open", text="MegaBag", icon='URL').url = "https://projects.blender.org/3DMish/MegaBag";
|
|
lc_main.operator("wm.url_open", text="MegaBag Wiki", icon='URL').url = "https://projects.blender.org/3DMish/MegaBag/wiki";
|
|
lc_main.separator() # ---------------------------
|
|
lc_main.operator("wm.url_open", text="Blender Website", icon='URL').url = "https://www.blender.org";
|
|
lc_main.operator("wm.url_open", text="Blender Store", icon='URL').url = "https://store.blender.org";
|
|
lc_main.operator("wm.url_open", text="Developer Community", icon='URL').url = "https://www.blender.org/get-involved/";
|
|
lc_main.operator("wm.url_open", text="User Community", icon='URL').url = "https://www.blender.org/support/user-community";
|
|
lc_main.separator() # ---------------------------
|
|
lc_main.operator("wm.url_open", text="Report a Bug", icon='URL').url = "https://developer.blender.org/maniphest/task/edit/form/1";
|
|
lc_main.separator() # ---------------------------
|
|
lc_main.operator("wm.url_open", text="Python API Reference", icon='URL').url = bpy.types.WM_OT_doc_view._prefix;
|
|
lc_main.operator("wm.operator_cheat_sheet", icon='TEXT');
|
|
lc_main.operator("wm.sysinfo", icon='TEXT');
|
|
lc_main.separator() # ---------------------------
|
|
lc_main.operator("wm.splash", icon='BLENDER');
|
|
|
|
class INFO_MT_view (Menu):
|
|
bl_label = "View";
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
|
|
lc_main.prop(context.area, "show_menus", text="Compact Menu" if get_prop("info_compact") else "Extended Menu");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.menu("INFO_MT_area");
|
|
|
|
|
|
class INFO_MT_info (Menu):
|
|
bl_label = "Info";
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
|
|
lc_main.operator("info.select_all", text="Select All").action = 'SELECT';
|
|
lc_main.operator("info.select_all", text="Deselect All").action = 'DESELECT';
|
|
lc_main.operator("info.select_all", text="Invert Selection").action = 'INVERT';
|
|
lc_main.operator("info.select_all", text="Toggle Selection").action = 'TOGGLE';
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("info.select_box");
|
|
lc_main.separator; # ---------------------------
|
|
lc_main.operator("info.report_delete", text="Delete");
|
|
lc_main.operator("info.report_copy", text="Copy");
|
|
|
|
|
|
class INFO_MT_area (Menu):
|
|
bl_label = "Area";
|
|
|
|
def draw(self, context):
|
|
lc_main = self.layout;
|
|
|
|
if context.space_data.type == 'VIEW_3D':
|
|
lc_main.operator("screen.region_quadview");
|
|
lc_main.separator();
|
|
|
|
lc_main.operator("screen.area_split", text="Horizontal Split").direction = 'HORIZONTAL';
|
|
lc_main.operator("screen.area_split", text="Vertical Split").direction = 'VERTICAL';
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("screen.screen_full_area");
|
|
lc_main.operator("screen.screen_full_area", text="Toggle Fullscreen Area").use_hide_panels = True;
|
|
lc_main.operator("screen.area_dupli");
|
|
lc_main.separator(); # ---------------------------
|
|
lc_main.operator("screen.area_close");
|
|
|
|
class INFO_MT_context_menu (Menu):
|
|
bl_label = "Info Context Menu";
|
|
|
|
def draw(self, _context):
|
|
layout = self.layout;
|
|
|
|
layout.operator("info.report_copy", text="Copy");
|
|
layout.operator("info.report_delete", text="Delete");
|
|
|
|
def register_nodes (self, context):
|
|
if get_prop("upgrade_info"): register();
|
|
else: unregister();
|
|
|
|
if ver_less(2,79,5):
|
|
classes = [
|
|
INFO_HT_header, INFO_MT_file, INFO_MT_file_new, INFO_MT_file_recover,
|
|
INFO_MT_file_defaults, INFO_MT_edit, INFO_MT_game, INFO_MT_render,
|
|
INFO_MT_window, INFO_MT_help, INFO_MT_editor_menus,
|
|
];
|
|
else:
|
|
classes = [
|
|
INFO_HT_header, INFO_MT_info, INFO_MT_view,
|
|
INFO_MT_context_menu, INFO_MT_editor_menus,
|
|
];
|
|
|
|
def register ():
|
|
global bl_conf;
|
|
|
|
r_unregister_class(bl_conf);
|
|
q_register_class(classes);
|
|
|
|
def unregister ():
|
|
global bl_conf;
|
|
|
|
q_unregister_class(classes);
|
|
r_register_class(bl_conf);
|