Draw Layout for Collection Properties?

I’m working with a collection property for the first time - here’s my code:


class ssCamAnglesPG(bpy.types.PropertyGroup):
    toggle_still = bpy.props.BoolProperty(name="Still",description="Render still frame based on angle",default=False)
    toggle_turn = bpy.props.BoolProperty(name="Turn",description="Render turntable based on angle",default=False)
    tl_controls = bpy.props.StringProperty(default="toggle_still:toggle_turn", options={"HIDDEN"})

def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.ss_camAngles = bpy.props.CollectionProperty(type=ssCamAnglesPG)
    bpy.types.Scene.ss_camAngles_index = bpy.props.IntProperty()
    pass

class OBJECT_PT_sceneToolboxPanel(bpy.types.Panel):
    bl_idname = "OBJECT_PT_scene_toolbox"
    bl_label = "Katie Tools"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_context = "objectmode"   
    
    def draw(self, context):
        kt = bpy.context.window_manager.katietools
        engine = bpy.context.scene.render.engine
        layout = self.layout
        scn = bpy.context.scene

#RENDER
        col = layout.column(align=False)
                
        if kt.display_render == True:
            col.prop(kt, 'display_render', icon='RIGHTARROW')
        else:
            col.prop(kt, 'display_render', icon='DOWNARROW_HLT')
            
            col = layout.column(align=True)
            row = layout.row(align=True)
            
            row.prop(kt,"ren_type", expand=True) #Engine selector
            
            col = layout.column(align=True)
            row = layout.row(align=True)
                      
            col.label(text="Snapshot:")
            
            col.template_list(scn, "ss_camAngles", scn, "ss_camAngles_index", prop_list="tl_controls", rows=5)

Attached image #1 is my UI with each element for the 3 items is spaced out evenly. I want to manipulate the layout for the items to allow more room for the item name (“Angle.001”) via shrinking the area of the two toggles (“Still” and “Turn”). I assume this is possible based on Shape Key UI in attached image #2.

Any insight into how this is accomplished is very appreciated! :slight_smile:



using prop_list there is no way to control the scale, as there’s C code which just adds new rows without properties that you could access (if this was done in python, you could create a row and set scale_x and scale_y etc.)

you either need to enhance this patch:
http://wiki.blender.org/index.php/User:Mont29/Dev/UI_Template_List_Enhancement

or don’t draw your collection with a template_list, but with a custom set of rows/cols and a box around it

            row = layout.row()            
            row.label(text="Snapshot:")
            
            box = layout.box()
            row = box.row(align=True)
            for cam in context.scene.ss_camAngles:
                sub = row.column()
                sub.scale_x = 2
                sub.label(cam.name)
                
                sub = row.row()
                sub.prop(cam, "toggle_still")
                sub.prop(cam, "toggle_turn")

Ah cool, thanks for the second approach suggestion CoDEmanX! I’ll give that a shot