Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/add_menu_assets.cc
| Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | if (tree_type == nullptr || IDP_Int(tree_type) != node_tree->type) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| if (BLI_uuid_is_nil(meta_data.catalog_id)) { | if (BLI_uuid_is_nil(meta_data.catalog_id)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| const asset_system::AssetCatalog *catalog = all_library->catalog_service->find_catalog( | const asset_system::AssetCatalog *catalog = all_library->catalog_service->find_catalog( | ||||
| meta_data.catalog_id); | meta_data.catalog_id); | ||||
| if (catalog == nullptr) { | |||||
| return true; | |||||
| } | |||||
| assets_per_path.add(catalog->path, LibraryAsset{all_library_ref, asset}); | assets_per_path.add(catalog->path, LibraryAsset{all_library_ref, asset}); | ||||
| return true; | return true; | ||||
| }); | }); | ||||
| /* Build an own tree without any of the catalogs that don't have proper node group assets. */ | /* Build an own tree without any of the catalogs that don't have proper node group assets. */ | ||||
| asset_system::AssetCatalogTree catalogs_with_node_assets; | asset_system::AssetCatalogTree catalogs_with_node_assets; | ||||
| asset_system::AssetCatalogTree &catalog_tree = *all_library->catalog_service->get_catalog_tree(); | asset_system::AssetCatalogTree &catalog_tree = *all_library->catalog_service->get_catalog_tree(); | ||||
| catalog_tree.foreach_item([&](asset_system::AssetCatalogTreeItem &item) { | catalog_tree.foreach_item([&](asset_system::AssetCatalogTreeItem &item) { | ||||
| if (assets_per_path.lookup(item.catalog_path()).is_empty()) { | if (assets_per_path.lookup(item.catalog_path()).is_empty()) { | ||||
| return; | return; | ||||
| } | } | ||||
| asset_system::AssetCatalog *catalog = all_library->catalog_service->find_catalog( | asset_system::AssetCatalog *catalog = all_library->catalog_service->find_catalog( | ||||
| item.get_catalog_id()); | item.get_catalog_id()); | ||||
| if (catalog == nullptr) { | |||||
| return; | |||||
| } | |||||
| catalogs_with_node_assets.insert_item(*catalog); | catalogs_with_node_assets.insert_item(*catalog); | ||||
| }); | }); | ||||
| /* Build another map storing full asset paths for each tree item, in order to have stable | /* Build another map storing full asset paths for each tree item, in order to have stable | ||||
| * pointers to asset catalog paths to use for context pointers. This is necessary because | * pointers to asset catalog paths to use for context pointers. This is necessary because | ||||
| * #asset_system::AssetCatalogTreeItem doesn't store its full path directly. */ | * #asset_system::AssetCatalogTreeItem doesn't store its full path directly. */ | ||||
| Map<const asset_system::AssetCatalogTreeItem *, asset_system::AssetCatalogPath> | Map<const asset_system::AssetCatalogTreeItem *, asset_system::AssetCatalogPath> | ||||
| full_catalog_per_tree_item; | full_catalog_per_tree_item; | ||||
| ▲ Show 20 Lines • Show All 178 Lines • Show Last 20 Lines | |||||