Created
September 26, 2022 21:23
-
-
Save demohero101/b369984f17e4cbd42cdfb463f939a1ea to your computer and use it in GitHub Desktop.
Add-on Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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