2022-02-15

import bpy


class HelloWorldPanel(bpy.types.Panel):   
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_category = "My panel"
    #bl_context = "object"

    def draw(self, context):
        layout = self.layout

        obj = context.object
        box = layout.box()
        row = box.row()

        
        row.label(text="Hello world!", icon='WORLD_DATA')

        row = box.row()
        row.label(text="Active object is: " + obj.name)
        
        row = box.row()
        row.prop(obj, "name")

        row = box.row()
        row.operator("mesh.primitive_cube_add")
        
        
        
        row = box.row()
        #row.prop(animation_settings, "animated_trunk")


def register():
    bpy.utils.register_class(HelloWorldPanel)


def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)


if __name__ == "__main__":
    register()

你可能感兴趣的:(2022-02-15)