Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/TEXT_EDIT_MENU.py
Last active August 29, 2015 14:00
Show Gist options
  • Save zeffii/11320146 to your computer and use it in GitHub Desktop.
Save zeffii/11320146 to your computer and use it in GitHub Desktop.
import bpy
class SubMenu(bpy.types.Menu):
bl_idname = "OBJECT_MT_select_submenu"
bl_label = "Select"
def draw(self, context):
layout = self.layout
layout.operator("object.select_all", text="Select/Deselect All")
# access this operator as a submenu
layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
def menu_draw(self, context):
self.layout.menu("OBJECT_MT_select_submenu")
bpy.utils.register_class(SubMenu)
bpy.types.TEXT_MT_templates.append(menu_draw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment