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:29:31 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-10-22 17:31:32 +0300
commit70aad5f498fcd7ed52f3422edda3021e5d4f9538 (patch)
treebbd80c11425cd55ef01ad67e3a3e57768d1271b5 /source/blender/blenkernel/intern/asset_library.cc
parent16ffa7bb6e519edd039683fe83031542d7059d96 (diff)
Asset Catalogs: support reloading without losing local changes
Keep track of unsaved asset catalog changes, in a more granular way than just one boolean per asset library. Individual catalogs can now be marked with a flag `has_unsaved_changes`. This is taken into account when reloading data from the catalog definition file (CDF): - New catalog in CDF: gets loaded - Already-known catalog in CDF: - local unsaved changes: on-disk catalog is ignored - otherwise: on-disk catalog replaces in-memory one - Already-known catalog that does not exist in CDF: - local unsaved changes: catalog is kept around - otherwise: catalog is deleted. Because this saving-is-also-loading behaviour, the "has unsaved changes" flags are all stored in the undo buffer; undoing after saving will not change the CDF, but at least it'll undo the loading from disk, and it'll re-mark any changes as "not saved". Reviewed By: Severin Differential Revision: https://developer.blender.org/D12967
Diffstat (limited to 'source/blender/blenkernel/intern/asset_library.cc')
-rw-r--r--source/blender/blenkernel/intern/asset_library.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/asset_library.cc b/source/blender/blenkernel/intern/asset_library.cc
index 6c4660ae75d..aae8a289d32 100644
--- a/source/blender/blenkernel/intern/asset_library.cc
+++ b/source/blender/blenkernel/intern/asset_library.cc
@@ -128,6 +128,11 @@ void AssetLibrary::load(StringRefNull library_root_directory)
this->catalog_service = std::move(catalog_service);
}
+void AssetLibrary::refresh()
+{
+ this->catalog_service->reload_catalogs();
+}
+
namespace {
void asset_library_on_save_post(struct Main *main,
struct PointerRNA **pointers,