blender/scripts/templates_py/UI/menu_simple.py
quackarooni a0dafebac9 UI: subdirectory support for Menu.menu_path, use for text templates
Create submenus for common template types in the text editor as the menu
was getting too long.

Common categories such as Gizmo, UI & Operators are now in their own
directories, displayed as submenus.

Menu.menu_path now supports expanding sub-menus recursively.

Ref !154643
2026-03-05 11:04:52 +11:00

27 lines
571 B
Python

import bpy
class SimpleCustomMenu(bpy.types.Menu):
bl_label = "Simple Custom Menu"
bl_idname = "OBJECT_MT_simple_custom_menu"
def draw(self, context):
layout = self.layout
layout.operator("wm.open_mainfile")
layout.operator("wm.save_as_mainfile")
def register():
bpy.utils.register_class(SimpleCustomMenu)
def unregister():
bpy.utils.unregister_class(SimpleCustomMenu)
if __name__ == "__main__":
register()
# The menu can also be called from scripts
bpy.ops.wm.call_menu(name=SimpleCustomMenu.bl_idname)