def menu_func(self, context):
self.layout.operator("YOUR OPERATOR BL_IDNAME")
# bl_idname should be in form of "something.something"
# or YourClass.bl_idname
def register():
bpy.utils.register_module(__name__)
# this adds your menu to shift-a add object menu
bpy.types.INFO_MT_add.prepend(menu_func)
# if you want to add to mesh menu use INFO_MT_mesh_add
# other menu classes you can find in \scripts\startup\bl_ui\
# by looking into the files there (i.e.: space_view3d.py)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.INFO_MT_add.remove(menu_func)
if __name__ == "__main__":
register()
Jaroslav Jerryno Novotny
- 51.4k
- 7
- 131
- 218