[Bf-blender-cvs] [2356f60c620] master: UI: Don't show button context menu for drag-labels

Julian Eisel noreply at git.blender.org
Mon Sep 2 15:41:58 CEST 2019


Commit: 2356f60c6200188a2f88d6d890ff78fa8fd2b4d3
Author: Julian Eisel
Date:   Mon Sep 2 15:30:56 2019 +0200
Branches: master
https://developer.blender.org/rB2356f60c6200188a2f88d6d890ff78fa8fd2b4d3

UI: Don't show button context menu for drag-labels

While the vast majority of labels would never get a button context menu
(as opposed to the regular context menu of this region), draggable
labels would still reach code for such context menu creation. From what
I can tell only file browser icons/thumbnails and the properties editor
data path would be affected. The button context menu doesn't make sense
for them, so let the region context menu show up instead.

If at some point we want button context menus for specific labels, we
can make checks more granular.

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

M	source/blender/editors/interface/interface_context_menu.c

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

diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index 970c9e31c50..580ff527bf6 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -490,8 +490,9 @@ static void ui_but_menu_add_path_operators(uiLayout *layout, PointerRNA *ptr, Pr
 
 bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
 {
-  /* having this menu for some buttons makes no sense */
-  if (but->type == UI_BTYPE_IMAGE) {
+  /* ui_but_is_interactive() may let some buttons through that should not get a context menu - it
+   * doesn't make sense for them. */
+  if (ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_IMAGE)) {
     return false;
   }



More information about the Bf-blender-cvs mailing list