2
$\begingroup$

Is there a way to "glue" input fields together in Python, like in the Properties > Render > Resolution?

enter image description here

It's not a layout box, it's not a IntVector...

I was surprised to see in how many ways a FloatVector can be displayed (e.g. numbers, RGB, RGBA, ...). Perhaps I missed an option somewhere?

$\endgroup$

1 Answer 1

5
$\begingroup$

This is an excerpt from properties_render.py. You can right click the property and choose Edit Source.

The properties are drawn using UILayout.column(). Specifically, it is the align=True, a property of the column, which causes the properties to appear to be 'glued' together.

def draw(self, context):
    layout = self.layout

    scene = context.scene
    rd = scene.render

    row = layout.row(align=True)
    row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
    row.operator("render.preset_add", text="", icon='ZOOMIN')
    row.operator("render.preset_add", text="", icon='ZOOMOUT').remove_active = True

    split = layout.split()

    col = split.column()
    sub = col.column(align=True)
    sub.label(text="Resolution:")
    sub.prop(rd, "resolution_x", text="X")
    sub.prop(rd, "resolution_y", text="Y")
    sub.prop(rd, "resolution_percentage", text="")
$\endgroup$
1
  • $\begingroup$ Nifty feature... I didn't know about it. $\endgroup$
    – karamike
    Commented Nov 30, 2014 at 16:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .