Page MenuHome

UI: Improve walk navigation in UI List template
ClosedPublic

Authored by Nathan Craddock (natecraddock) on Apr 24 2021, 6:16 AM.

Details

Summary

Add improved arrow key walk navigation in grid layout UI List templates.
Pressing up or down walks the active item to the adjacent row in that
direction, while left and right walk through the items along the columns
wrapping at the rows.

There are two behaviors that may need to be changed.

  1. When walking past the top or bottom of the list the active item is clamped to the first or last item. For example, pressing up on the third item on the first row, the first item will be activated. The alternate behavior could be to not take action on up or down arrow when on the first or last row.
  1. This allows using left and right to navigate up and down regular UI lists. It would be simple to prevent this, but I don't see any issue with this.

Diff Detail

Repository
rB Blender
Branch
todo-T97540-uilist-walk (branched from master)
Build Status
Buildable 14204
Build 14204: arc lint + arc unit

Event Timeline

Nathan Craddock (natecraddock) requested review of this revision.Apr 24 2021, 6:16 AM
Nathan Craddock (natecraddock) created this revision.

Thanks for looking into this, works just fine!

When walking past the top or bottom of the list the active item is clamped to the first or last item. For example, pressing up on the third item on the first row, the first item will be activated. The alternate behavior could be to not take action on up or down arrow when on the first or last row.

That's how the File Browser works too, and I think that's fine.
Plus, in this case trying to wrap around would unveil a tricky issue: To change the pose when a new item is activated (uiListDyn.custom_activate_optype), we need the button, or better said the button's constext-store (which stores the asset-handle it represents). However the UI-list code only creates the buttons that are actually visible, so for the handling on a wrap around to work, we'd have to force an immediate redraw or find some other solution, so the button is created in time.

This allows using left and right to navigate up and down regular UI lists. It would be simple to prevent this, but I don't see any issue with this.

Don't see an issue with that either. Again, the File Browser works like this too.

This revision is now accepted and ready to land.Apr 26 2021, 8:12 PM

You can just commit this to the asset-browser-poselib branch.

Sounds good, will get it committed soon.