2023-08-16 00:20:26 +10:00
|
|
|
# SPDX-FileCopyrightText: 2009-2023 Blender Authors
|
2023-06-15 13:09:04 +10:00
|
|
|
#
|
2022-02-11 09:07:11 +11:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2023-06-15 13:09:04 +10:00
|
|
|
|
2011-09-22 19:50:41 +00:00
|
|
|
from bpy.types import Header, Menu
|
2009-06-30 19:20:45 +00:00
|
|
|
|
2022-08-29 15:56:31 +02:00
|
|
|
from bpy.app.translations import contexts as i18n_contexts
|
|
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class INFO_HT_header(Header):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'INFO'
|
2009-06-30 19:20:45 +00:00
|
|
|
|
2019-08-10 01:45:58 +10:00
|
|
|
def draw(self, context):
|
2009-10-31 19:31:45 +00:00
|
|
|
layout = self.layout
|
2018-04-21 10:28:27 +02:00
|
|
|
layout.template_header()
|
2010-03-06 01:40:29 +00:00
|
|
|
|
2019-08-10 01:45:58 +10:00
|
|
|
INFO_MT_editor_menus.draw_collapsible(context, layout)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class INFO_MT_editor_menus(Menu):
|
|
|
|
|
bl_idname = "INFO_MT_editor_menus"
|
|
|
|
|
bl_label = ""
|
|
|
|
|
|
2019-09-15 05:26:15 +10:00
|
|
|
def draw(self, _context):
|
2019-08-10 01:45:58 +10:00
|
|
|
layout = self.layout
|
|
|
|
|
layout.menu("INFO_MT_view")
|
|
|
|
|
layout.menu("INFO_MT_info")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class INFO_MT_view(Menu):
|
|
|
|
|
bl_label = "View"
|
|
|
|
|
|
2019-09-15 05:26:15 +10:00
|
|
|
def draw(self, _context):
|
2019-08-10 01:45:58 +10:00
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
layout.menu("INFO_MT_area")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class INFO_MT_info(Menu):
|
|
|
|
|
bl_label = "Info"
|
|
|
|
|
|
2019-09-15 05:26:15 +10:00
|
|
|
def draw(self, _context):
|
2019-08-10 01:45:58 +10:00
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
layout.operator("info.select_all", text="Select All").action = 'SELECT'
|
|
|
|
|
layout.operator("info.select_all", text="Deselect All").action = 'DESELECT'
|
|
|
|
|
layout.operator("info.select_all", text="Invert Selection").action = 'INVERT'
|
|
|
|
|
layout.operator("info.select_all", text="Toggle Selection").action = 'TOGGLE'
|
|
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
|
|
layout.operator("info.select_box")
|
|
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
|
|
# Disabled because users will likely try this and find
|
|
|
|
|
# it doesn't work all that well in practice.
|
|
|
|
|
# Mainly because operators needs to run in the right context.
|
|
|
|
|
|
|
|
|
|
# layout.operator("info.report_replay")
|
|
|
|
|
# layout.separator()
|
|
|
|
|
|
|
|
|
|
layout.operator("info.report_delete", text="Delete")
|
|
|
|
|
layout.operator("info.report_copy", text="Copy")
|
2017-03-18 20:03:24 +11:00
|
|
|
|
2018-05-24 18:35:19 +02:00
|
|
|
|
|
|
|
|
class INFO_MT_area(Menu):
|
|
|
|
|
bl_label = "Area"
|
2022-08-29 15:56:31 +02:00
|
|
|
bl_translation_context = i18n_contexts.id_windowmanager
|
2018-05-24 18:35:19 +02:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
if context.space_data.type == 'VIEW_3D':
|
|
|
|
|
layout.operator("screen.region_quadview")
|
2018-11-06 22:05:05 +01:00
|
|
|
layout.separator()
|
|
|
|
|
|
2018-11-21 01:33:33 +01:00
|
|
|
layout.operator("screen.area_split", text="Horizontal Split").direction = 'HORIZONTAL'
|
|
|
|
|
layout.operator("screen.area_split", text="Vertical Split").direction = 'VERTICAL'
|
|
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
2018-05-24 18:35:19 +02:00
|
|
|
layout.operator("screen.screen_full_area")
|
2019-05-22 00:27:01 +10:00
|
|
|
layout.operator(
|
|
|
|
|
"screen.screen_full_area",
|
2021-04-22 19:57:49 -07:00
|
|
|
text="Toggle Fullscreen Area").use_hide_panels = True
|
|
|
|
|
layout.operator("screen.area_dupli")
|
|
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
|
|
layout.operator("screen.area_close")
|
2018-05-24 18:35:19 +02:00
|
|
|
|
|
|
|
|
|
2019-08-10 11:35:16 +02:00
|
|
|
class INFO_MT_context_menu(Menu):
|
|
|
|
|
bl_label = "Info Context Menu"
|
|
|
|
|
|
2019-09-15 05:26:15 +10:00
|
|
|
def draw(self, _context):
|
2019-08-10 11:35:16 +02:00
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
|
|
layout.operator("info.report_copy", text="Copy")
|
|
|
|
|
layout.operator("info.report_delete", text="Delete")
|
|
|
|
|
|
2019-09-10 06:11:52 +10:00
|
|
|
|
2017-03-18 20:03:24 +11:00
|
|
|
classes = (
|
|
|
|
|
INFO_HT_header,
|
2019-08-10 01:45:58 +10:00
|
|
|
INFO_MT_editor_menus,
|
2018-05-24 18:35:19 +02:00
|
|
|
INFO_MT_area,
|
2019-08-10 01:45:58 +10:00
|
|
|
INFO_MT_view,
|
|
|
|
|
INFO_MT_info,
|
2019-08-10 11:35:16 +02:00
|
|
|
INFO_MT_context_menu,
|
2017-03-18 20:03:24 +11:00
|
|
|
)
|
|
|
|
|
|
2011-04-04 10:13:04 +00:00
|
|
|
if __name__ == "__main__": # only for live edit.
|
2017-03-18 20:03:24 +11:00
|
|
|
from bpy.utils import register_class
|
|
|
|
|
for cls in classes:
|
|
|
|
|
register_class(cls)
|