49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
bl_info = {
|
|
"name": "Hello World Addon",
|
|
"author": "BacklogEngine",
|
|
"version": (1, 0),
|
|
"blender": (2, 80, 0),
|
|
"location": "View3D > Sidebar > Hello World",
|
|
"description": "Adds a button that prints Hello World",
|
|
"category": "Development",
|
|
}
|
|
|
|
import bpy
|
|
|
|
class HELLO_OT_print_hello_world(bpy.types.Operator):
|
|
"""Print Hello World to console"""
|
|
bl_idname = "hello.print_hello_world"
|
|
bl_label = "Print Hello World"
|
|
|
|
def execute(self, context):
|
|
print("Hello World")
|
|
self.report({'INFO'}, "Hello World printed to console!")
|
|
return {'FINISHED'}
|
|
|
|
class HELLO_PT_main_panel(bpy.types.Panel):
|
|
"""Creates a Panel in the 3D Viewport N-Panel"""
|
|
bl_label = "Hello World"
|
|
bl_idname = "HELLO_PT_main_panel"
|
|
bl_space_type = 'VIEW_3D'
|
|
bl_region_type = 'UI'
|
|
bl_category = "Hello World"
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
layout.operator("hello.print_hello_world")
|
|
|
|
classes = (
|
|
HELLO_OT_print_hello_world,
|
|
HELLO_PT_main_panel,
|
|
)
|
|
|
|
def register():
|
|
for cls in classes:
|
|
bpy.utils.register_class(cls)
|
|
|
|
def unregister():
|
|
for cls in reversed(classes):
|
|
bpy.utils.unregister_class(cls)
|
|
|
|
if __name__ == "__main__":
|
|
register() |