I tried to create a menu panel for drawing the mesh, so I applied:
import bpy
class CustomPanel(bpy.types.Panel):
"""A Custom Panel in the Viewport Toolbar"""
bl_label = "Generate"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
def draw(self, context):
layout = self.layout
row = layout.row()
row.label(text="Generate objects:")
split = layout.split()
col = split.column(align=True)
layout.label(text="Primitives:")
layout.operator("mesh.primitive_plane_add", text="Plane", icon='MESH_PLANE')
layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
layout.operator("mesh.primitive_ico_sphere_add", text="Ico Sphere", icon='MESH_ICOSPHERE')
layout.operator("mesh.primitive_cylinder_add", text="Cylinder", icon='MESH_CYLINDER')
layout.operator("mesh.primitive_cone_add", text="Cone", icon='MESH_CONE')
layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
#
col.operator("mesh.primitive_plane_add", text="Plane"),
col.operator("mesh.primitive_cube_add", text="Cube")
def register():
bpy.utils.register_class(CustomPanel)
def unregister():
bpy.utils.unregister_class(CustomPanel)
if __name__ == "__main__":
register()
but when I try to ecris as a drop-down list, like this: How to make compare with Menus I haven't succeeded, someone help me how writing in menu panel?