-
Notifications
You must be signed in to change notification settings - Fork 6
ui_simple
Atticus_id edited this page Feb 22, 2021
·
1 revision
import bpy
class LayoutDemoPanel(bpy.types.Panel):
"""Creates a Panel in the scene context of the properties editor"""
bl_label = "这个是面板"
bl_idname = "SCENE_PT_layout"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
def draw(self, context):
layout = self.layout
scene = context.scene
layout.label(text="这个是标签")
layout.prop(scene, "frame_start",text ='这个是参数')
layout.label(text=" 这个是操作符(按钮)")
layout.operator("render.render")
layout.label(text=" 这个是间隔")
layout.separator()
layout.label(text=" 这个是横向划分")
row = layout.row()
row.prop(scene, "frame_start")
row.prop(scene, "frame_end")
layout.label(text=" 这个是紧贴的横向划分")
row = layout.row(align=True)
row.prop(scene, "frame_start")
row.prop(scene, "frame_end")
layout.label(text=" 这个按比例切分")
split = layout.split(factor = 0.3)
col = split.column()
col.label(text="这个是竖向划分:")
col.prop(scene, "frame_end")
col.prop(scene, "frame_start")
col = split.box().column(align=True)
col.label(text="这个是先绘制盒子再竖向划分:")
col.prop(scene, "frame_start")
col.prop(scene, "frame_end")
layout.label(text="这个是缩放")
row = layout.row()
row.scale_y = 3.0
row.operator("render.render")
layout.label(text="这个是横向缩放:")
row = layout.row(align=True)
row.operator("render.render")
sub = row.row()
sub.scale_x = 2.0
sub.operator("render.render")
row.operator("render.render")
layout.label(text="这个是指定icon",icon = 'SCENE')
layout.operator("render.render",text="操作符也有icon",icon = 'SCENE')
def register():
bpy.utils.register_class(LayoutDemoPanel)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanel)
if __name__ == "__main__":
register()