2011-02-18 09:47:37 +01:00
|
|
|
"""
|
|
|
|
Submenus
|
|
|
|
++++++++
|
2015-09-08 06:30:05 +02:00
|
|
|
|
2011-02-18 09:47:37 +01:00
|
|
|
This menu demonstrates some different functions.
|
|
|
|
"""
|
|
|
|
import bpy
|
|
|
|
|
|
|
|
|
|
|
|
class SubMenu(bpy.types.Menu):
|
|
|
|
bl_idname = "OBJECT_MT_select_submenu"
|
|
|
|
bl_label = "Select"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2011-02-25 17:19:50 +01:00
|
|
|
|
2012-01-14 07:58:03 +01:00
|
|
|
layout.operator("object.select_all", text="Select/Deselect All").action = 'TOGGLE'
|
|
|
|
layout.operator("object.select_all", text="Inverse").action = 'INVERT'
|
2011-02-18 09:47:37 +01:00
|
|
|
layout.operator("object.select_random", text="Random")
|
|
|
|
|
|
|
|
# access this operator as a submenu
|
|
|
|
layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
# expand each operator option into this menu
|
2019-06-06 17:12:49 +02:00
|
|
|
layout.operator_enum("object.light_add", "type")
|
2011-02-18 09:47:37 +01:00
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
# use existing memu
|
|
|
|
layout.menu("VIEW3D_MT_transform")
|
|
|
|
|
|
|
|
|
|
|
|
bpy.utils.register_class(SubMenu)
|
|
|
|
|
|
|
|
# test call to display immediately.
|
|
|
|
bpy.ops.wm.call_menu(name="OBJECT_MT_select_submenu")
|