[Bf-blender-cvs] [11abc1be394] temp-asset-library-all: Use "All" library for node search menu building
Julian Eisel
noreply at git.blender.org
Fri Dec 2 20:29:31 CET 2022
Commit: 11abc1be394ccb148c5cda3ecde6dbe0d5eb4f27
Author: Julian Eisel
Date: Fri Dec 2 20:28:33 2022 +0100
Branches: temp-asset-library-all
https://developer.blender.org/rB11abc1be394ccb148c5cda3ecde6dbe0d5eb4f27
Use "All" library for node search menu building
Code was manually building the search menu items from all asset
libraries, this is simpler now.
===================================================================
M source/blender/editors/space_node/add_node_search.cc
===================================================================
diff --git a/source/blender/editors/space_node/add_node_search.cc b/source/blender/editors/space_node/add_node_search.cc
index ba060ab3925..85c79d5e57d 100644
--- a/source/blender/editors/space_node/add_node_search.cc
+++ b/source/blender/editors/space_node/add_node_search.cc
@@ -93,12 +93,15 @@ static void search_items_for_asset_metadata(const bNodeTree &node_tree,
search_items.append(std::move(item));
}
-static void gather_search_items_for_asset_library(const bContext &C,
- const bNodeTree &node_tree,
- const AssetLibraryReference &library_ref,
- Set<std::string> &r_added_assets,
- Vector<AddNodeItem> &search_items)
+static void gather_search_items_for_all_assets(const bContext &C,
+ const bNodeTree &node_tree,
+ Set<std::string> &r_added_assets,
+ Vector<AddNodeItem> &search_items)
{
+ AssetLibraryReference library_ref{};
+ library_ref.custom_library_index = -1;
+ library_ref.type = ASSET_LIBRARY_ALL;
+
AssetFilterSettings filter_settings{};
filter_settings.id_types = FILTER_ID_NT;
@@ -117,26 +120,6 @@ static void gather_search_items_for_asset_library(const bContext &C,
});
}
-static void gather_search_items_for_all_assets(const bContext &C,
- const bNodeTree &node_tree,
- Set<std::string> &r_added_assets,
- Vector<AddNodeItem> &search_items)
-{
- int i;
- LISTBASE_FOREACH_INDEX (const bUserAssetLibrary *, asset_library, &U.asset_libraries, i) {
- AssetLibraryReference library_ref{};
- library_ref.custom_library_index = i;
- library_ref.type = ASSET_LIBRARY_CUSTOM;
- /* Skip local assets to avoid duplicates when the asset is part of the local file library. */
- gather_search_items_for_asset_library(C, node_tree, library_ref, r_added_assets, search_items);
- }
-
- AssetLibraryReference library_ref{};
- library_ref.custom_library_index = -1;
- library_ref.type = ASSET_LIBRARY_LOCAL;
- gather_search_items_for_asset_library(C, node_tree, library_ref, r_added_assets, search_items);
-}
-
static void gather_search_items_for_node_groups(const bContext &C,
const bNodeTree &node_tree,
const Set<std::string> &local_assets,
More information about the Bf-blender-cvs
mailing list