Skip to content

Instantly share code, notes, and snippets.

@demohero101
Created September 26, 2022 21:23
Show Gist options
  • Save demohero101/b369984f17e4cbd42cdfb463f939a1ea to your computer and use it in GitHub Desktop.
Save demohero101/b369984f17e4cbd42cdfb463f939a1ea to your computer and use it in GitHub Desktop.
Add-on Example
bl_info = {
"name": "Add Objects",
"author": "Demohero",
"version": (1, 0),
"blender": (3, 3, 0),
"location": "View3D > Sidebar",
"description": "Adds objects to the scene",
"warning": "",
"doc_url": "",
"category": "Add Objects",
}
import bpy
class AddObjects(bpy.types.Panel):
"""Creates a Panel in the UI"""
bl_label = "Add Objects"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "Add Objects"
def draw(self, context):
layout = self.layout
row = layout.row()
row.label(text="Add Mesh Objects:")
row = layout.row(align=True)
row.operator("mesh.primitive_cube_add", text="Cube", icon="MESH_CUBE")
row.operator("mesh.primitive_plane_add", text="Plane", icon="MESH_PLANE")
row = layout.row(align=True)
row.operator("mesh.primitive_uv_sphere_add", text="UV Sphere", icon="MESH_UVSPHERE")
row.operator("mesh.primitive_cylinder_add", text="Cylinder", icon="MESH_CYLINDER")
row = layout.row()
row.label(text="Add Curve Objects:")
row = layout.row(align=True)
row.operator("curve.primitive_bezier_curve_add", text="Bezier", icon="IPO_BEZIER")
row.operator("curve.primitive_bezier_circle_add", text="Circle", icon="CURVE_BEZCIRCLE")
row = layout.row()
row.label(text="Mixed:")
row = layout.row(align=True)
row.operator("object.armature_add", text="Armature", icon="OUTLINER_OB_ARMATURE")
row.operator("object.camera_add", text="Camera", icon="VIEW_CAMERA")
def register():
bpy.utils.register_class(AddObjects)
def unregister():
bpy.utils.unregister_class(AddObjects)
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment