Fix T62016: Outliner visibility icons drag behaviour broken

We are mixing bool and fancy 3-in-1 func-set buttons in the outliner.
So they would return different pushed state in
ui_drag_toggle_but_pushed_state().

We now have a callback function that allows the button to set its own
pushed_button_state callback function.

Note: This is a bit of overkill since we are planning to change the
3-in-1 outliner buttons. That said, it may be nice to have, since in the
future we can mix those buttons for other things.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D4434
This commit is contained in:
Dalai Felinto
2019-03-01 13:14:16 -03:00
parent a577499c75
commit 92182495da
5 changed files with 46 additions and 7 deletions

View File

@@ -4456,6 +4456,12 @@ void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN)
but->tip_argN = argN;
}
void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, void *arg)
{
but->pushed_state_func = func;
but->pushed_state_arg = arg;
}
uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip)
{
uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);