Fix double loading of asset catalogs when reloading "All" library

`refresh_catalogs()` for the "All" asset library effectively does the
same as iterating over all other asset libraries and calling
`get_asset_library()` on them. So doing both just performs the same work
twice.
This commit is contained in:
Julian Eisel
2024-02-23 13:02:54 +01:00
parent 49c7dfe904
commit ee3291dc6d

View File

@@ -207,6 +207,12 @@ void AssetLibraryService::reload_all_library_catalogs_if_dirty()
AssetLibrary *AssetLibraryService::get_asset_library_all(const Main *bmain)
{
if (all_library_) {
CLOG_INFO(&LOG, 2, "get all lib (cached)");
all_library_->refresh_catalogs();
return all_library_.get();
}
/* (Re-)load all other asset libraries. */
for (AssetLibraryReference &library_ref : all_valid_asset_library_refs()) {
/* Skip self :) */
@@ -218,12 +224,6 @@ AssetLibrary *AssetLibraryService::get_asset_library_all(const Main *bmain)
this->get_asset_library(bmain, library_ref);
}
if (all_library_) {
CLOG_INFO(&LOG, 2, "get all lib (cached)");
all_library_->refresh_catalogs();
return all_library_.get();
}
CLOG_INFO(&LOG, 2, "get all lib (loaded)");
all_library_ = std::make_unique<AllAssetLibrary>();