minor update to panel templates/examples - the panel examples didnt show an operator and use scene rather then sc for the active scene name.

This commit is contained in:
Campbell Barton 2012-09-23 23:11:24 +00:00
parent 60a5e05a4d
commit e038d7212a
2 changed files with 22 additions and 19 deletions

View File

@ -12,36 +12,36 @@ class LayoutDemoPanel(bpy.types.Panel):
def draw(self, context):
layout = self.layout
sc = context.scene
#Create a simple row.
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(sc, "frame_start")
row.prop(sc, "frame_end")
#Create an row where the buttons are aligned to each other.
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(sc, "frame_start")
row.prop(sc, "frame_end")
#Create two columns, by using a split layout.
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(sc, "frame_end")
col.prop(sc, "frame_start")
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(sc, "frame_start")
col.prop(sc, "frame_end")
col.prop(scene, "frame_start")
col.prop(scene, "frame_end")
def register():

View File

@ -22,6 +22,9 @@ class HelloWorldPanel(bpy.types.Panel):
row = layout.row()
row.prop(obj, "name")
row = layout.row()
row.operator("mesh.primitive_cube_add")
def register():
bpy.utils.register_class(HelloWorldPanel)