[Bf-blender-cvs] [7fed4c06c2f] master: Fix keying-set selector broken

Julian Eisel noreply at git.blender.org
Thu Mar 17 17:54:23 CET 2022


Commit: 7fed4c06c2ff45d9ab4f809d542b6e1ee8f76488
Author: Julian Eisel
Date:   Thu Mar 17 17:45:29 2022 +0100
Branches: master
https://developer.blender.org/rB7fed4c06c2ff45d9ab4f809d542b6e1ee8f76488

Fix keying-set selector broken

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

Caused by d8e3bcf770c2. 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.

===================================================================

M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/interface_layout.c

===================================================================

diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 694ae78ca9e..a7a2409ef17 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -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,
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 17f0ae1f2d4..cbc21bd481f 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -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,



More information about the Bf-blender-cvs mailing list