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-19 17:55:46 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-10-19 17:55:46 +0300
commita7ade57e11113a74b11bd0330b073a252ad1c026 (patch)
treefbb970c90f2559c550016528cba0d1ee1bed0e12
parent79a88b5e919d56b27e11cadb79ca30474c071af8 (diff)
Asset Catalogs: allow creating catalog in unsaved blend file
Allow creating a new asset catalog in a yet-to-be-saved blend file. The problem was caused by `AssetLibrary` not having an `AssetCatalogService` right after creation; only after loading data from disk was this instance created. It's now always there.
-rw-r--r--source/blender/blenkernel/BKE_asset_library.hh1
-rw-r--r--source/blender/blenkernel/intern/asset_library.cc4
2 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_asset_library.hh b/source/blender/blenkernel/BKE_asset_library.hh
index b8b4b0f8447..6d5c9836b26 100644
--- a/source/blender/blenkernel/BKE_asset_library.hh
+++ b/source/blender/blenkernel/BKE_asset_library.hh
@@ -40,6 +40,7 @@ namespace blender::bke {
struct AssetLibrary {
std::unique_ptr<AssetCatalogService> catalog_service;
+ AssetLibrary();
~AssetLibrary();
void load(StringRefNull library_root_directory);
diff --git a/source/blender/blenkernel/intern/asset_library.cc b/source/blender/blenkernel/intern/asset_library.cc
index 48ace8efea1..32e7aab235d 100644
--- a/source/blender/blenkernel/intern/asset_library.cc
+++ b/source/blender/blenkernel/intern/asset_library.cc
@@ -102,6 +102,10 @@ void BKE_asset_library_refresh_catalog_simplename(struct AssetLibrary *asset_lib
namespace blender::bke {
+AssetLibrary::AssetLibrary() : catalog_service(std::make_unique<AssetCatalogService>())
+{
+}
+
AssetLibrary::~AssetLibrary()
{
if (on_save_callback_store_.func) {