blob: 9ffa0cbeeea927eb66b1ce6e9474844735d4bdae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
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
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
row.prop(scene, "frame_end")
# Create an row where the buttons are aligned to each other.
layout.label(text=" Aligned Row")
row = layout.row(align=True)
row.prop(scene, "frame_start")
row.prop(scene, "frame_end")
# Create two columns, by using a split layout.
split = layout.split()
# First column
col = split.column()
col.label(text="Column One:")
col.prop(scene, "frame_end")
col.prop(scene, "frame_start")
# Second column, aligned
col = split.column(align=True)
col.label(text="Column Two")
col.prop(scene, "frame_start")
col.prop(scene, "frame_end")
def register():
bpy.utils.register_class(LayoutDemoPanel)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanel)
if __name__ == "__main__":
register()
|