From 4680331749aa716fe01445c473308f3ff80ec8c9 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 13 May 2022 15:55:11 +0200 Subject: Fix T97518: All buttons with eyedropper highlight if one is hovered Issue is that the operator acts on the active button, and also uses that in the poll. So the actually active button would affect the poll of a different button. For the superimposed icons we need to be able to execute these polls properly for non-active buttons. This enables temporarily overriding the active button for lookups via context. While a bit of a hack it makes sense conceptually. Reviewed By: Campbell Barton Maniphest Tasks: T97518 Differential Revision: https://developer.blender.org/D14880 --- source/blender/editors/interface/interface_handlers.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/interface/interface_handlers.c') diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index ad354560183..3b5d8ce89f2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -8717,13 +8717,23 @@ static uiBut *ui_context_button_active(const ARegion *region, bool (*but_check_c /* find active button */ LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { LISTBASE_FOREACH (uiBut *, but, &block->buttons) { + if (but->flag & UI_BUT_ACTIVE_OVERRIDE) { + activebut = but; + break; + } if (but->active) { activebut = but; + break; } - else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE)) { + if (but->flag & UI_BUT_LAST_ACTIVE) { activebut = but; + break; } } + + if (activebut) { + break; + } } if (activebut && (but_check_cb == NULL || but_check_cb(activebut))) { -- cgit v1.2.3