Fix keying-set selector broken

The menu for Timeline > Keying > Active Keying Set wouldn't show up.

Caused by d8e3bcf770. The function to attach search menu data to the button
would be called twice with different arguments for the same button now.
Shouldn't be an issue in general, but the first call now had the unexpected
side effect that the button would get disabled. Make sure it's re-enabled when
the second call sets the proper search data now.
This commit is contained in:
Julian Eisel 2022-03-17 17:45:29 +01:00
parent 17906794f5
commit 7fed4c06c2
2 changed files with 6 additions and 1 deletions

View File

@ -1275,7 +1275,8 @@ void ui_layout_remove_but(uiLayout *layout, const uiBut *but);
*/
bool ui_layout_replace_but_ptr(uiLayout *layout, const void *old_but_ptr, uiBut *new_but);
/**
* \note May reallocate \a but, so the possibly new address is returned.
* \note May reallocate \a but, so the possibly new address is returned. May also override the
* #UI_BUT_DISABLED flag depending on if a search pointer-property pair was provided/found.
*/
uiBut *ui_but_add_search(uiBut *but,
PointerRNA *ptr,

View File

@ -2751,6 +2751,10 @@ uiBut *ui_but_add_search(
ui_rna_collection_search_arg_free_fn,
NULL,
NULL);
/* If this is called multiple times for the same button, an earlier call may have taken the
* else branch below so the button was disabled. Now we have a searchprop, so it can be enabled
* again. */
but->flag &= ~UI_BUT_DISABLED;
}
else if (but->type == UI_BTYPE_SEARCH_MENU) {
/* In case we fail to find proper searchprop,