Scripting a Custom Tool Menu

In this Blender 2.5 video tutorial we’ll be writing a script that creates a custom menu to which we can add operators, enums and sub-menus, as well as taking a look at registering a hotkey for it through Python.

Leave Comment

Discussion

30 Responses to “Scripting a Custom Tool Menu”
  1. Posts: 1
    Robb Tarte says:

    Can I call one custom menu from within another. I made a custom menu for edit mode and then wanted to include menu items to change view (usually done via numpad). I want to create another custom menu and call it from within my main custom menu. Important parts below.

    class RobbMeshTools(bpy.types.Menu):
    bl_label = “Robbs_Mesh_Tools”
    bl_idname = “robbs.mesh.tools_menu”

    def draw(self, context):
    layout = self.layout
    layout.operator_context = ‘INVOKE_REGION_WIN’
    layout.menu(“robb.changeview.menu”, text=”TestingMenu”)

    class RobbViewMenu(bpy.types.Menu):
    bl_label = “Robb_View_Menu”
    bl_idname = “robb.changeview.menu”

    def draw(self, context):
    layout = self.layout
    layout.operator_context = ‘INVOKE_REGION_WIN’

    layout.operator(“view3d.viewnumpad”, text=”TOP”).type=’FRONT’

Leave a Comment

You must be logged in to post a comment.