【Blender Scripts】简单的panle 操作
在属性的标题;里面加一个自己的插页:
import bpy
import bpy.utils.previews
UI_PREV = bpy.utils.previews.new()
UI_PREV.load("MYICON", "C:\\Users\\LMX\\Desktop\\浴室.jpg", 'IMAGE')
class HelloWorldPanel(bpy.types.Panel):
bl_idname = "OBJECT_PT_hello_world"
bl_label = "Label"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
def draw(self, context):
layout = self.layout
col = layout.column()
col.label(text="My Tools")
row = layout.row()
row.operator("object.select_all")
row.operator("render.opengl")
box = layout.box()
for o in bpy.data.objects:
box.prop(o, "name", icon_value = UI_PREV['MYICON'].icon_id)
box.prop(o, "location")
def draw_header(self, context):
self.layout.label(text="My Panel")
bpy.utils.register_class(HelloWorldPanel)
结果
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/292f5f676efc0f9f9ff539751ed94119.png)