Merge branch 'blender-v4.5-release'

This commit is contained in:
Julian Eisel
2025-06-16 12:08:15 +02:00
4 changed files with 13 additions and 4 deletions

View File

@@ -488,9 +488,7 @@ bool AssetCatalogService::write_to_disk_ex(const CatalogFilePath &blend_file_pat
return catalog_collection_->catalog_definition_file_->write_to_disk();
}
if (catalog_collection_->catalogs_.is_empty() &&
catalog_collection_->deleted_catalogs_.is_empty())
{
if (catalog_collection_->is_empty()) {
/* Avoid saving anything, when there is nothing to save. */
return true; /* Writing nothing when there is nothing to write is still a success. */
}

View File

@@ -12,6 +12,11 @@
namespace blender::asset_system {
bool AssetCatalogCollection::is_empty() const
{
return catalogs_.is_empty() && deleted_catalogs_.is_empty();
}
std::unique_ptr<AssetCatalogCollection> AssetCatalogCollection::deep_copy() const
{
auto copy = std::make_unique<AssetCatalogCollection>();

View File

@@ -44,6 +44,10 @@ class AssetCatalogCollection {
AssetCatalogCollection(const AssetCatalogCollection &other) = delete;
AssetCatalogCollection(AssetCatalogCollection &&other) noexcept = default;
/** Check if this contains any catalogs or deleted catalogs. Doesn't check if a CDF is present.
*/
bool is_empty() const;
std::unique_ptr<AssetCatalogCollection> deep_copy() const;
using OnDuplicateCatalogIdFn =
FunctionRef<void(const AssetCatalog &existing, const AssetCatalog &to_be_ignored)>;

View File

@@ -262,7 +262,9 @@ AssetLibrary *AssetLibraryService::move_runtime_current_file_into_on_disk_librar
"new on-disk library shouldn't have catalog definition files - root path "
"changed, so they would have to be relocated");
{
/* Create a CDF with the runtime catalogs that on-disk catalogs can be merged into. Only do if
* there's catalogs to write, otherwise we create empty CDFs on disk on every new .blend save. */
if (!catalog_service.catalog_collection_->is_empty()) {
char asset_lib_cdf_path[PATH_MAX];
BLI_path_join(asset_lib_cdf_path,
sizeof(asset_lib_cdf_path),