Page MenuHome

UI: Spread expanded enums over rows if space is narrow
Needs ReviewPublic

Authored by Julian Eisel (Severin) on Sep 9 2021, 12:32 PM.

Details

Reviewers
None
Group Reviewers
User Interface
Summary

This only applies to expanded enums in a property split layout.
Expanded enums are especially troublesome when the layout is narrow. So
idea here is to let them spread over multiple rows in such cases,
keeping them usable.
The layout width used as threshold is just an estimate (taking DPI and
zoom factor into account). For a smarter solution we'd have to do this
after the layout was entirely calculated, potentially re-running the
layout afterwards.

In some cases this behavior may not be needed ,e.g. the color-depth
property for image settings has short labels which fit nicely even in
narrow layouts. So this patch makes the behavior optional too by adding
a expand_no_responsive option to UILayout.prop().

D10505 proposed such a solution for its layouts. I think it's something
that could work well without being too intrusive. So worth checking if
we want this as general layout feature.

Diff Detail

Repository
rB Blender
Branch
master
Build Status
Buildable 16894
Build 16894: arc lint + arc unit

Event Timeline

Julian Eisel (Severin) requested review of this revision.Sep 9 2021, 12:32 PM
Julian Eisel (Severin) created this revision.
Julian Eisel (Severin) edited the summary of this revision. (Show Details)Sep 9 2021, 12:49 PM

Just a minor note about the title.

UI: Spread expanded enums over rows if space is narrow

To me, this reads as if you wrote:

UI: Spread expanded enums over rows if space is wide

You then realized you were describing the current behavior of using a row, and not the changed behavior of making a column. You edited the title to narrow, perhaps got distracted by something, and didn’t change the rest of the title.

I would retitle this as:

UI: Stack expanded enums into a column if space is narrow

It better matches your (much more clear IMO) comments in the code.

Use a column instead of a row for expanded enums when the available space is narrow.

When expanding buttons, enforce a column layout for narrow layouts

Why not just NOT expand the enum when there is little space? If the area is narrow then it could be that monitor space is at a premium or the user is trying to be compact, so expanding vertically could make it worse for them.

ogierm added a subscriber: ogierm.Sep 20 2021, 3:40 PM

Nice one!

I agree with @Harley Acheson (harley) here. Having them fold into a dropdown will make it work better with multiple items, add-ons, and overall more future-proof.

Tried the patch and it worked fine on Hair properties (like your screenshot), in Output settings, but I couldn't get it to work with light types (this would be a good example for having a dropdown over vertical radio buttons, due to having so many options).


This approach looks great, definitely 😍