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-18 13:33:53 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-10-18 15:21:41 +0300
commitf9113c4be836691ba599aab9b2f43e26333f8133 (patch)
tree6fa8fc9c1021538478f173e247d932c63929f15b /source/blender/blenkernel/BKE_asset_library.h
parent1f510376764debe3e91f736aec6b3af70567243f (diff)
Assets: add global `bke::AssetLibraryService` class
Add `blender::bke::AssetLibraryService` class that acts like a blendfile-scoped singleton. It's allocated upon the first call to `BKE_asset_library_load` and destroyed in the LOAD-PRE handler. The `AssetLibraryService` ensures that edits to asset catalogs are not lost when the asset browser editor closes (or even reloads). Instead, the `AssetLibrary` pointers it owns are kept around as long as the blend file is open. Reviewed By: Severin Maniphest Tasks: T92151 Differential Revision: https://developer.blender.org/D12885
Diffstat (limited to 'source/blender/blenkernel/BKE_asset_library.h')
-rw-r--r--source/blender/blenkernel/BKE_asset_library.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_asset_library.h b/source/blender/blenkernel/BKE_asset_library.h
index 12ca55c0ef4..b4674a8d932 100644
--- a/source/blender/blenkernel/BKE_asset_library.h
+++ b/source/blender/blenkernel/BKE_asset_library.h
@@ -29,9 +29,14 @@ extern "C" {
/** Forward declaration, defined in intern/asset_library.hh */
typedef struct AssetLibrary AssetLibrary;
-/** TODO(@sybren): properly have a think/discussion about the API for this. */
+/**
+ * Return the #AssetLibrary rooted at the given directory path.
+ *
+ * Will return the same pointer for repeated calls, until another blend file is loaded.
+ *
+ * To get the in-memory-only "current file" asset library, pass an empty path.
+ */
struct AssetLibrary *BKE_asset_library_load(const char *library_path);
-void BKE_asset_library_free(struct AssetLibrary *asset_library);
/**
* Try to find an appropriate location for an asset library root from a file or directory path.