UI: Refresh grayed out state of active buttons on redraw

When the "disabled" state of an active button (as in, button that's
hovered or otherwise being interacted with) would change, that change
wouldn't be reflected until the button becomes inactive.

This is needed for blender/blender!159238: When online assets are
displayed in "Add" menus, they should be downloaded first, and the menu
needs to refresh once the download is done. Without this change, the
downloaded asset would remain grayed out until the mouse moved over a
different asset. Usually the disabled state of a button doesn't change
while it's active, so this wasn't a notable issue so far. But with the
background downloading, it can change while the mouse hovers the button.

To solve this, the disabled state should always be retrieved from the
latest incarnation of a button, and not use the previous state in case
of an active button.
This commit is contained in:
Julian Eisel 2026-05-29 16:43:51 +02:00
parent 5ccbdb9900
commit 2047f4966d

View file

@ -945,7 +945,7 @@ static void but_update_old_active_from_new(Button *oldbut, Button *but)
BLI_assert(oldbut->active || oldbut->semi_modal_state);
/* flags from the buttons we want to refresh, may want to add more here... */
const int flag_copy = BUT_REDALERT | UI_HAS_ICON | UI_SELECT_DRAW;
const int flag_copy = BUT_REDALERT | BUT_DISABLED | UI_HAS_ICON | UI_SELECT_DRAW;
const int drawflag_copy = BUT_HAS_QUICK_TOOLTIP | BUT_NO_TOOLTIP;
/* still stuff needs to be copied */