Revert "Fix #113201: Assets in same folder as current file ignored in All library"

This reverts commit 7705e49bcd.

It broke the bf_asset_system_tests test and this cannot be fixed now so reverting.
This commit is contained in:
Thomas Dinges
2023-10-16 12:32:42 +02:00
parent 8220820611
commit 1f0520034a
2 changed files with 5 additions and 9 deletions

View File

@@ -122,7 +122,7 @@ AssetLibrary *AssetLibraryService::get_asset_library_on_disk(eAssetLibraryType l
std::string normalized_root_path = utils::normalize_directory_path(root_path); std::string normalized_root_path = utils::normalize_directory_path(root_path);
std::unique_ptr<AssetLibrary> *lib_uptr_ptr = on_disk_libraries_.lookup_ptr( std::unique_ptr<AssetLibrary> *lib_uptr_ptr = on_disk_libraries_.lookup_ptr(
{library_type, normalized_root_path}); normalized_root_path);
if (lib_uptr_ptr != nullptr) { if (lib_uptr_ptr != nullptr) {
CLOG_INFO(&LOG, 2, "get \"%s\" (cached)", normalized_root_path.c_str()); CLOG_INFO(&LOG, 2, "get \"%s\" (cached)", normalized_root_path.c_str());
AssetLibrary *lib = lib_uptr_ptr->get(); AssetLibrary *lib = lib_uptr_ptr->get();
@@ -139,7 +139,7 @@ AssetLibrary *AssetLibraryService::get_asset_library_on_disk(eAssetLibraryType l
/* Reload catalogs on refresh. */ /* Reload catalogs on refresh. */
lib->on_refresh_ = [](AssetLibrary &self) { self.catalog_service->reload_catalogs(); }; lib->on_refresh_ = [](AssetLibrary &self) { self.catalog_service->reload_catalogs(); };
on_disk_libraries_.add_new({library_type, normalized_root_path}, std::move(lib_uptr)); on_disk_libraries_.add_new(normalized_root_path, std::move(lib_uptr));
CLOG_INFO(&LOG, 2, "get \"%s\" (loaded)", normalized_root_path.c_str()); CLOG_INFO(&LOG, 2, "get \"%s\" (loaded)", normalized_root_path.c_str());
return lib; return lib;
} }

View File

@@ -9,7 +9,6 @@
#pragma once #pragma once
#include <optional> #include <optional>
#include <utility>
#include "AS_asset_library.hh" #include "AS_asset_library.hh"
@@ -39,12 +38,9 @@ namespace blender::asset_system {
class AssetLibraryService { class AssetLibraryService {
static std::unique_ptr<AssetLibraryService> instance_; static std::unique_ptr<AssetLibraryService> instance_;
/** Identify libraries with the library type, and the absolute path of the library's root path /* Mapping absolute path of the library's root path (normalize with #normalize_directory_path()!)
* (normalize with #normalize_directory_path()!). The type is relevant since the current file * the AssetLibrary instance. */
* library may point to the same path as a custom library. */ Map<std::string, std::unique_ptr<AssetLibrary>> on_disk_libraries_;
using OnDiskLibraryIdentifier = std::pair<eAssetLibraryType, std::string>;
/* Mapping of a (type, root path) pair to the AssetLibrary instance. */
Map<OnDiskLibraryIdentifier, std::unique_ptr<AssetLibrary>> on_disk_libraries_;
/** Library without a known path, i.e. the "Current File" library if the file isn't saved yet. If /** Library without a known path, i.e. the "Current File" library if the file isn't saved yet. If
* the file was saved, a valid path for the library can be determined and #on_disk_libraries_ * the file was saved, a valid path for the library can be determined and #on_disk_libraries_
* above should be used. */ * above should be used. */