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.
This commit is contained in:
Sybren A. Stüvel
2021-10-19 16:55:46 +02:00
parent 79a88b5e91
commit a7ade57e11
2 changed files with 5 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ namespace blender::bke {
struct AssetLibrary {
std::unique_ptr<AssetCatalogService> catalog_service;
AssetLibrary();
~AssetLibrary();
void load(StringRefNull library_root_directory);

View File

@@ -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) {