diff options
Diffstat (limited to 'source/blender/blenkernel/intern/asset_catalog.cc')
-rw-r--r-- | source/blender/blenkernel/intern/asset_catalog.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/asset_catalog.cc b/source/blender/blenkernel/intern/asset_catalog.cc index 38c712d7e75..62d03b2d79b 100644 --- a/source/blender/blenkernel/intern/asset_catalog.cc +++ b/source/blender/blenkernel/intern/asset_catalog.cc @@ -9,6 +9,7 @@ #include "BKE_asset_catalog.hh" #include "BKE_asset_library.h" +#include "BKE_asset_library.hh" #include "BLI_fileops.hh" #include "BLI_path_util.h" @@ -787,6 +788,41 @@ void AssetCatalogTree::foreach_root_item(const ItemIterFn callback) } } +bool AssetCatalogTree::is_empty() const +{ + return root_items_.empty(); +} + +AssetCatalogTreeItem *AssetCatalogTree::find_item(const AssetCatalogPath &path) +{ + AssetCatalogTreeItem *result = nullptr; + this->foreach_item([&](AssetCatalogTreeItem &item) { + if (result) { + /* There is no way to stop iteration. */ + return; + } + if (item.catalog_path() == path) { + result = &item; + } + }); + return result; +} + +AssetCatalogTreeItem *AssetCatalogTree::find_root_item(const AssetCatalogPath &path) +{ + AssetCatalogTreeItem *result = nullptr; + this->foreach_root_item([&](AssetCatalogTreeItem &item) { + if (result) { + /* There is no way to stop iteration. */ + return; + } + if (item.catalog_path() == path) { + result = &item; + } + }); + return result; +} + /* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */ |