Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-05-20 09:36:39 +0300
committerCampbell Barton <campbell@blender.org>2022-05-20 09:42:35 +0300
commitd27f4e84931798b4366a8058904dd967420a999c (patch)
treee1b70116d8892b286d9306e8e90529a8cbb77428 /source
parentf68fb8106429b4d6fb3e019940db79c17af94ad6 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.cc6
1 files changed, 6 insertions, 0 deletions
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;