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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-06-11 08:36:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-06-11 08:39:03 +0300
commitcc064acf0f43c978ad378b20ebe869f5373651a1 (patch)
tree07b521fd0076b3c30ef34c67cec908f19e40aee5 /source/blender/editors/interface
parenta76fc2f7ed9e7dbd5fb1e6a8eae5e7d93af10f5f (diff)
UI: exclude context menus from menu search
This causes the search result to be less predictable as well as including menu items multiple times.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_template_search_menu.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_template_search_menu.c b/source/blender/editors/interface/interface_template_search_menu.c
index 2c6b09168f4..8c673e4d5b5 100644
--- a/source/blender/editors/interface/interface_template_search_menu.c
+++ b/source/blender/editors/interface/interface_template_search_menu.c
@@ -469,6 +469,34 @@ static struct MenuSearch_Data *menu_items_from_ui_create(
}
}
+ {
+ /* Exclude context menus because:
+ * - The menu items are available elsewhere (and will show up multiple times).
+ * - Menu items depend on exact context, making search results unpredictable
+ * (exact number of items selected for example). See design doc T74158.
+ * There is one exception,
+ * as the outliner only exposes functionality via the context menu. */
+ GHashIterator iter;
+
+ for (WM_menutype_iter(&iter); (!BLI_ghashIterator_done(&iter));
+ (BLI_ghashIterator_step(&iter))) {
+ MenuType *mt = BLI_ghashIterator_getValue(&iter);
+ if (BLI_str_endswith(mt->idname, "_context_menu")) {
+ BLI_gset_add(menu_tagged, mt);
+ }
+ }
+ const char *idname_array[] = {
+ /* Add back some context menus. */
+ "OUTLINER_MT_context_menu",
+ };
+ for (int i = 0; i < ARRAY_SIZE(idname_array); i++) {
+ MenuType *mt = WM_menutype_find(idname_array[i], false);
+ if (mt != NULL) {
+ BLI_gset_remove(menu_tagged, mt, NULL);
+ }
+ }
+ }
+
/* Collect contexts, one for each 'ui_type'. */
struct MenuSearch_Context *wm_contexts = NULL;