Page MenuHome

Property Search: Set panel expansion when tab changes
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Sep 25 2020, 12:07 AM.

Details

Summary

With this patch, the panel expansion is properly set based on the search results when
the active tab in the properties editor changes. The multi-tab search patch actually
doesn't handle this because it runs on a duplicated set of panels not actually displayed.

This feature uncovered a subtle but fairly significant issue with the implementation of
property search. You can mind more detail on that here, T81113, but basically, the problem
was that the search needed multiple redraws to properly display the expansion of the
panels based on the search results. Because there is no animation of panel expansion
when switching tabs, the problem was exposed only now.

The good news is that the solution actually results in a fairly nice cleanup of the
property search code. Now, the search expansion-setting, freeing of the "search only"
buttons, and panel size calculation all happen in a single place at the end of the panel
layout pass.

Removing the "search only" layout root flag means that we need another way to tell
if buttons are in a panel header. To do that, this patch adds two flags to uiButtonGroup.
The first stops the addition of new button groups so that we can use a single group
for all buttons in the header, and the second just says that the group represents a panel
header. There are two helper functions for this in interface_panel.c.

Diff Detail

Repository
rB Blender
Branch
property-search-switch-tab-expansion (branched from master)
Build Status
Buildable 10395
Build 10395: arc lint + arc unit

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Sep 25 2020, 12:07 AM
  • Cleanup: Else after return
  • Merge branch 'master' into property-search-switch-tab-expansion
Julian Eisel (Severin) requested changes to this revision.Oct 2 2020, 7:38 PM

It's nice that this gets rid of some existing pain points. I am a bit against flagging buttons as being in a panel header, that does seem odd and nice to avoid.
We discussed an alternative way to keep that information by moving the button groups to block level and keeping them around for a bit longer.

This revision now requires changes to proceed.Oct 2 2020, 7:38 PM
  • Use button groups instead of uiBut flag for panel header buttons
  • Don't add size from inactive subpanels to panel height

Didn't actually test this, I assume it does what's intended. If there are issues you can fix them in master.

source/blender/editors/interface/interface_intern.h
437 ↗(On Diff #29544)

Maybe a button group should have some kind of class identifier, so this could be tagged as "panel-header". That would seem more extendible than these specific, predefined flags.
But this is runtime data, so you can leave it as is. If there's ever a need for something more flexible the class idea is good to keep in mind.

source/blender/editors/interface/interface_panel.c
235–240

Noticed these checks are out-dated, so I removed them rBe839179b014a.

This revision is now accepted and ready to land.Oct 3 2020, 2:50 PM