Page MenuHome

UI Code Quality: Use derived structs for search buttons and decorators
Needs ReviewPublic

Authored by Julian Eisel (Severin) on Sun, May 3, 10:59 PM.

Details

Summary

The current on-size-fits-all uiBut creates quite a mess, where it's hard to
reason about which members are free for use, under which conditions they are
used and how. This tries to untangle that mess.
A draw-back is that many casts have to be done although this seems reasonable.

(I don't expect an in-depth review, but would like to have the general design
change reviewed first.)

A complication was that we sometimes change the button type after it's created.
So I had to add logic to reallocate the button for use with the new, possibly
derived struct. Ideally that wouldn't be needed, but for now that's what we have.
This is also something I'd like to have reviewed.

Part of T74432.

Diff Detail

Repository
rB Blender
Branch
temp-ui-cleanup (branched from master)
Build Status
Buildable 7868
Build 7868: arc lint + arc unit

Event Timeline

Julian Eisel (Severin) requested review of this revision.Sun, May 3, 10:59 PM
source/blender/editors/include/UI_interface.h
539

I can just ged rid of this macro and do the checks in place, don't mind really.

source/blender/editors/interface/interface.c
3823

Should do a NULL-check for but->layout in case the button isn't inside any layout.