Page MenuHome

UI Expand Enum Items Over Multiple Rows

Authored by Jeroen Bakker (jbakker) on Apr 17 2019, 10:51 AM.



Inside D4694 we developed this change. But during initial review we wanted to review this part separately.
Reason of concern is that the split_row option is an extra parameter that will be present in all prop calls in python.
In this revision we will review this part of the code and see if we can find a better solution for it.

During an initial brainstorm we came with the next option:

  • don't add the parameter, but extract it from the available enum_items. We could define a line break separator like {0, "\n", null, null, null} for this.
  • add a special case for when the enum is rendered on a grid_flow

Diff Detail

rB Blender

Event Timeline

Is there any case that prevents us from just always doing this, not even having it as a parameter? Is there anything in the interface that this breaks?

The point of the separator is to add some break in the enum items, to me it makes sense if the expand case takes that into account automatically.

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Apr 17 2019, 3:28 PM
Jeroen Bakker (jbakker) updated this revision to Diff 14778.

Split when expanding horizontal and not rendering UI_BTYPE_ROW

924 ↗(On Diff #14778)

This is just a test, needs to be removed before committing.

I talked to Bastien about this, there may be a way to have grid flow take care of this without the need to even define separators. I guess just to talk to each other and figure out if it's possible or if we still need this.

Support to render on grid_flow

Using grid_flow

I will eventually render 5-6 items, so the alignment is not really nice. I expected that even_columns or even_rows would take care of this. For example when rendering 5 items all items will be rendered as a fully horizontal and vertical aligned.

Added and tested logic for column_flow


TODO: clang-format

To me this layout looks fine.

@Brecht Van Lommel (brecht) @Campbell Barton (campbellbarton)

I discussed with @Bastien Montagne (mont29). We changed the logic to work within a grid_flow and a column_flow. Also cleaned up the code as it fitted better on the original code. When you have time please review!

LGTM, nice it can use grid/column-flow logic.

This revision is now accepted and ready to land.Apr 18 2019, 1:30 PM
This revision was automatically updated to reflect the committed changes.