2012-08-01 12:21:23 +00:00
|
|
|
import bpy
|
|
|
|
|
|
|
|
|
|
|
|
class LayoutDemoPanel(bpy.types.Panel):
|
|
|
|
"""Creates a Panel in the scene context of the properties editor"""
|
|
|
|
bl_label = "Layout Demo"
|
|
|
|
bl_idname = "SCENE_PT_layout"
|
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "scene"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
2012-09-23 23:11:24 +00:00
|
|
|
scene = context.scene
|
|
|
|
|
|
|
|
# Create a simple row.
|
2012-08-01 12:21:23 +00:00
|
|
|
layout.label(text=" Simple Row:")
|
2012-09-23 23:11:24 +00:00
|
|
|
|
2012-08-01 12:21:23 +00:00
|
|
|
row = layout.row()
|
2012-09-23 23:11:24 +00:00
|
|
|
row.prop(scene, "frame_start")
|
|
|
|
row.prop(scene, "frame_end")
|
|
|
|
|
|
|
|
# Create an row where the buttons are aligned to each other.
|
2012-10-12 18:10:15 +00:00
|
|
|
layout.label(text=" Aligned Row:")
|
2012-09-23 23:11:24 +00:00
|
|
|
|
2012-08-01 12:21:23 +00:00
|
|
|
row = layout.row(align=True)
|
2012-09-23 23:11:24 +00:00
|
|
|
row.prop(scene, "frame_start")
|
|
|
|
row.prop(scene, "frame_end")
|
|
|
|
|
|
|
|
# Create two columns, by using a split layout.
|
2012-08-01 12:21:23 +00:00
|
|
|
split = layout.split()
|
2012-09-23 23:11:24 +00:00
|
|
|
|
2012-08-01 12:21:23 +00:00
|
|
|
# First column
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Column One:")
|
2012-09-23 23:11:24 +00:00
|
|
|
col.prop(scene, "frame_end")
|
|
|
|
col.prop(scene, "frame_start")
|
|
|
|
|
2012-08-01 12:21:23 +00:00
|
|
|
# Second column, aligned
|
|
|
|
col = split.column(align=True)
|
2012-10-12 18:10:15 +00:00
|
|
|
col.label(text="Column Two:")
|
2012-09-23 23:11:24 +00:00
|
|
|
col.prop(scene, "frame_start")
|
|
|
|
col.prop(scene, "frame_end")
|
2014-04-15 03:11:48 +00:00
|
|
|
|
2012-10-12 18:10:15 +00:00
|
|
|
# Big render button
|
|
|
|
layout.label(text="Big Button:")
|
|
|
|
row = layout.row()
|
|
|
|
row.scale_y = 3.0
|
|
|
|
row.operator("render.render")
|
2014-04-15 03:11:48 +00:00
|
|
|
|
2012-10-12 18:10:15 +00:00
|
|
|
# Different sizes in a row
|
|
|
|
layout.label(text="Different button sizes:")
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.operator("render.render")
|
2014-04-15 03:11:48 +00:00
|
|
|
|
2012-10-12 18:10:15 +00:00
|
|
|
sub = row.row()
|
|
|
|
sub.scale_x = 2.0
|
|
|
|
sub.operator("render.render")
|
2014-04-15 03:11:48 +00:00
|
|
|
|
2012-10-12 18:10:15 +00:00
|
|
|
row.operator("render.render")
|
2012-08-01 12:21:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
def register():
|
|
|
|
bpy.utils.register_class(LayoutDemoPanel)
|
|
|
|
|
|
|
|
|
|
|
|
def unregister():
|
|
|
|
bpy.utils.unregister_class(LayoutDemoPanel)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
register()
|