Hi,
I wonder if it is possible to create an addon for making custom menu easilly.
For exemple, we have a listing of commands > https://www.dropbox.com/s/5sd7nzu3t44ufki/commandes_blender.py
We normaly could make an addon with the listing who will make a custom menu easilly.
For a custom menu we just need that king of code
import bpy
class customMenu(bpy.types.Menu):
bl_label = "Custom Menu"
bl_idname = "View3D.customMenu"
def draw(self, context):
layout = self.layout
layout.operator("mesh.primitive_cube_add", text="Cube", icon='MESH_CUBE')
def register():
bpy.utils.register_class(customMenu)
bpy.ops.wm.call_menu(name=customMenu.bl_idname)
def unregister():
bpy.utils.unregister_class(customMenu)
if __name__ == "__main__": register()
To add a submenu, we just need this kind of code.
class subMenu1(bpy.types.Menu):
bl_label = "Add Mesh"
def draw(self, context):
layout = self.layout
layout.operator("mesh.primitive_cube_add", text="Cube", icon='MESH_CUBE')
bpy.utils.register_class(subMenu1)
and add layout.menu(“subMenu1”, icon=‘OBJECT_DATAMODE’) to draw the menu in the custom menu.
So it’s not so complicated, so is it possible to automatise that ?