Blender Git Loki

Git Commits -> Revision 49f088e

Revision 49f088e by Julian Eisel (master)
August 7, 2020, 13:17 (GMT)
UI Code Quality: Use derived structs for search buttons and decorators

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.
`uiBut` also has members that aren't used at times, violating the "don't
pay for what you don't use" principle.

To address this, we want to move to typed buttons, where `uiBut` is just
a base struct and each type extends it as needed. That structures data
better and type specific data is only available if it's actually used by
a button type.

Two trade-offs:
* Many casts to the derived type have to be done.
* Sometimes we 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.

Part of T74432.

Differential Revision: https://developer.blender.org/D7610

Reviewed by: Brecht Van Lommel, Campbell Barton

Commit Details:

Full Hash: 49f088e2d0936ed3b5f08881a14ad83c19951791
Parent Commit: 48e0893
Lines Changed: +383, -172

12 Modified Paths:

/source/blender/editors/include/UI_interface.h (+4, -4) (Diff)
/source/blender/editors/interface/interface.c (+158, -41) (Diff)
/source/blender/editors/interface/interface_anim.c (+23, -17) (Diff)
/source/blender/editors/interface/interface_context_menu.c (+1, -1) (Diff)
/source/blender/editors/interface/interface_handlers.c (+23, -7) (Diff)
/source/blender/editors/interface/interface_intern.h (+46, -26) (Diff)
/source/blender/editors/interface/interface_layout.c (+72, -44) (Diff)
/source/blender/editors/interface/interface_ops.c (+4, -3) (Diff)
/source/blender/editors/interface/interface_query.c (+1, -1) (Diff)
/source/blender/editors/interface/interface_region_search.c (+47, -25) (Diff)
/source/blender/editors/interface/interface_templates.c (+2, -2) (Diff)
/source/blender/editors/interface/interface_widgets.c (+2, -1) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021