[Bf-blender-cvs] [d27f4e84931] blender-v3.2-release: Fix popup menu memory activating labels when names matched menu items

Campbell Barton noreply at git.blender.org
Fri May 20 08:46:41 CEST 2022


Commit: d27f4e84931798b4366a8058904dd967420a999c
Author: Campbell Barton
Date:   Fri May 20 16:36:39 2022 +1000
Branches: blender-v3.2-release
https://developer.blender.org/rBd27f4e84931798b4366a8058904dd967420a999c

Fix popup menu memory activating labels when names matched menu items

When labels in popups (typically headings) matched the name of a button,
the label would be activated instead of the button.

This caused the unwrap menu in the UV editor not to re-select "Unwrap"
when opening a second time.

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

M	source/blender/editors/interface/interface_region_menu_popup.cc

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

diff --git a/source/blender/editors/interface/interface_region_menu_popup.cc b/source/blender/editors/interface/interface_region_menu_popup.cc
index e843a275d08..a22f7218203 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.cc
+++ b/source/blender/editors/interface/interface_region_menu_popup.cc
@@ -129,6 +129,12 @@ static uiBut *ui_popup_menu_memory__internal(uiBlock *block, uiBut *but)
 
   /* get */
   LISTBASE_FOREACH (uiBut *, but_iter, &block->buttons) {
+    /* Prevent labels (typically headings), from being returned in the case the text
+     * happens to matches one of the menu items.
+     * Skip separators too as checking them is redundant. */
+    if (ELEM(but_iter->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE)) {
+      continue;
+    }
     if (mem[hash_mod] ==
         ui_popup_string_hash(but_iter->str, but_iter->flag & UI_BUT_HAS_SEP_CHAR)) {
       return but_iter;



More information about the Bf-blender-cvs mailing list