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:
authorSybren A. Stüvel <sybren@blender.org>2021-10-22 17:32:05 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-10-22 17:32:05 +0300
commit85312f2236784716fc24cc5d3236cb016fb99828 (patch)
treea35037f8c03a7863d4791a70a177de1b15b04570 /source/blender/blenkernel/BKE_asset_catalog.hh
parent70aad5f498fcd7ed52f3422edda3021e5d4f9538 (diff)
Asset Browser: Show "orphaned" assets in "Unassigned" catalog
Show assets that have an unknown catalog ID assigned in the "Unassigned" catalog. Another catalog named "Orphans" was considered as well, but that would clash with the usual handling of Blender (discarding orphan data on save) and thus that idea was discarded. Manifest Task: T91949
Diffstat (limited to 'source/blender/blenkernel/BKE_asset_catalog.hh')
-rw-r--r--source/blender/blenkernel/BKE_asset_catalog.hh14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_asset_catalog.hh b/source/blender/blenkernel/BKE_asset_catalog.hh
index 902c0e414d6..766a3f34a66 100644
--- a/source/blender/blenkernel/BKE_asset_catalog.hh
+++ b/source/blender/blenkernel/BKE_asset_catalog.hh
@@ -119,6 +119,11 @@ class AssetCatalogService {
AssetCatalog *find_catalog_by_path(const AssetCatalogPath &path) const;
/**
+ * Return true only if this catalog is known.
+ * This treats deleted catalogs as "unknown". */
+ bool is_catalog_known(CatalogID catalog_id) const;
+
+ /**
* Create a filter object that can be used to determine whether an asset belongs to the given
* catalog, or any of the catalogs in the sub-tree rooted at the given catalog.
*
@@ -488,17 +493,22 @@ using MutableAssetCatalogOrderedSet = std::set<AssetCatalog *, AssetCatalogLessT
/**
* Filter that can determine whether an asset should be visible or not, based on its catalog ID.
*
- * \see AssetCatalogService::create_filter()
+ * \see AssetCatalogService::create_catalog_filter()
*/
class AssetCatalogFilter {
public:
bool contains(CatalogID asset_catalog_id) const;
+ /* So that all unknown catalogs can be shown under "Unassigned". */
+ bool is_known(CatalogID asset_catalog_id) const;
+
protected:
friend AssetCatalogService;
const Set<CatalogID> matching_catalog_ids;
+ const Set<CatalogID> known_catalog_ids;
- explicit AssetCatalogFilter(Set<CatalogID> &&matching_catalog_ids);
+ explicit AssetCatalogFilter(Set<CatalogID> &&matching_catalog_ids,
+ Set<CatalogID> &&known_catalog_ids);
};
} // namespace blender::bke