Skip to content

Instantly share code, notes, and snippets.

@toruta39
Created September 8, 2013 16:00
Show Gist options
  • Save toruta39/6485891 to your computer and use it in GitHub Desktop.
Save toruta39/6485891 to your computer and use it in GitHub Desktop.
bl_info = {
"name": "My Custom Menu",
"category": "3D View",
"author": "Joshua Zhang"
}
import bpy
# Define a custom menu
class customMenu(bpy.types.Menu):
bl_label = "Custom Menu"
bl_idname = "view3D.custom_menu"
# Define the operators and functions
def draw(self, context):
layout = self.layout
layout.operator("mesh.primitive_cube_add")
layout.operator("object.duplicate_move")
def register():
bpy.utils.register_class(customMenu)
# bpy.ops.wm.call_menu(name=customMenu.bl_idname)
def unregister():
bpy.utils.unregister_class(customMenu)
# Ensuring register the menu only when this script is triggered in itself
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment