First of all - this design task has no user visible changes.
Motivation
Currently there are some rough edges to the UI API (interface_*.c/h)
- uiBut struct stores members for all buttons, making some logic highly confusing (below), so I propose to use a polymorphic struct, as we do already with ID and Modifier types. (so we would have uiBut_ColorBand, uiBut_Text, uiBut_Number... etc, as well as uiBut which would only store values common to all buttons).
/* both these values use depends on the button type- (polymorphic struct or union would be nicer for this stuff) */
/* (type == HSVCUBE), Use UI_GRAD_* values. - (type == NUM), Use to store RNA 'step' value, for dragging and click-step.
- (type == LABEL), Use (a1 == 1.0f) to use a2 as a blending factor (wow, this is imaginative!).
- (type == SCROLL) Use as scroll size.
- (type == SEARCH_MENU) Use as number or rows.
- (type == COLOR) Use as indication of color palette */ float a1;
/* (type == HSVCIRCLE ), Use to store the luminosity. - (type == NUM), Use to store RNA 'precision' value, for dragging and click-step.
- (type == LABEL), If (a1 == 1.0f) use a2 as a blending factor.
- (type == SEARCH_MENU) Use as number or columns.
- (type == COLOR) Use as indication of active palette color */ float a2;
- (polymorphic struct or union would be nicer for this stuff) */
- API has become inconsistent, eg: ui_is_but_float, ui_but_is_editable, ui_button_is_active.
- Button types have inconsistent naming (and a bit ambiguous)
BUT, BUTM, ROW, TOG, BUT_NORMAL, OPTION, OPTIONN. |
Scope
To ensure this is completed in a reasonable time and not breaking code, this is mainly a cleanup/refactor, larger changes can be done after.
Out of Scope (for now)
- Re-organizing files
- Moving functions between files.
- Rewriting functionality.
Timeframe
This branch will be reviewed and merged after 2.72 release to avoid conflicts from having many small changes.
Changes
This is to keep track of the changes which will eventually be applied to a branch.
Rename API Functions & Enum's
See: ui_api_refactor.py
This script contains a replacement table for proposed API changes.
Struct's
TODO