From ee3291dc6df2bdd86d8c67d12bf55531555a1ea2 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 23 Feb 2024 13:02:54 +0100 Subject: [PATCH] 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. --- .../asset_system/intern/asset_library_service.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/asset_system/intern/asset_library_service.cc b/source/blender/asset_system/intern/asset_library_service.cc index 0c3a11061ab..941c589855a 100644 --- a/source/blender/asset_system/intern/asset_library_service.cc +++ b/source/blender/asset_system/intern/asset_library_service.cc @@ -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();