diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-10-12 12:28:16 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-10-12 12:28:16 +0300 |
commit | ad1735f8ede966b7d49423928ad05cca25119949 (patch) | |
tree | 27c351114b6f66ef50418445fb35e16c9edbf6e1 /source/blender/blenkernel/BKE_asset_catalog.hh | |
parent | ac657bee0142f96fcd3fa5d56455658834a19b19 (diff) |
Asset Catalogs: recursive deletion of catalogs & children
Recursively delete asset catalogs with `AssetCatalogService:prune_...`
functions. This deletes the catalog and all of its children.
The old `delete_catalog` function has been renamed to
`delete_catalog_by_id()`, and is now a lower-level function (no deletion
of children, no rebuilding of the tree). The `prune_catalogs_by_path()`
and `prune_catalogs_by_id()` do delete children and do rebuild the
catalog tree.
Manifest task: T91634
Diffstat (limited to 'source/blender/blenkernel/BKE_asset_catalog.hh')
-rw-r--r-- | source/blender/blenkernel/BKE_asset_catalog.hh | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_asset_catalog.hh b/source/blender/blenkernel/BKE_asset_catalog.hh index bd18fdf1d6e..4ea6abd65e0 100644 --- a/source/blender/blenkernel/BKE_asset_catalog.hh +++ b/source/blender/blenkernel/BKE_asset_catalog.hh @@ -117,9 +117,21 @@ class AssetCatalogService { AssetCatalog *create_catalog(const AssetCatalogPath &catalog_path); /** - * Soft-delete the catalog, ensuring it actually gets deleted when the catalog definition file is - * written. */ - void delete_catalog(CatalogID catalog_id); + * Delete all catalogs with the given path, and their children. + */ + void prune_catalogs_by_path(const AssetCatalogPath &path); + + /** + * Delete all catalogs with the same path as the identified catalog, and their children. + * This call is the same as calling `prune_catalogs_by_path(find_catalog(catalog_id)->path)`. + */ + void prune_catalogs_by_id(CatalogID catalog_id); + + /** + * Delete a catalog, without deleting any of its children and without rebuilding the catalog + * tree. This is a lower-level function than #prune_catalogs_by_path. + */ + void delete_catalog_by_id(CatalogID catalog_id); /** * Update the catalog path, also updating the catalog path of all sub-catalogs. |