WIP: Rewrite asset browser as separate editor #107576
|
@ -363,6 +363,7 @@ class AssetListStorage {
|
|||
const AssetLibraryReference &library_reference, eFileSelectType filesel_type);
|
||||
|
||||
static AssetListMap &global_storage();
|
||||
static bool &global_storage_is_destructed();
|
||||
};
|
||||
|
||||
void AssetListStorage::fetch_library(const AssetLibraryReference &library_reference,
|
||||
|
@ -383,6 +384,7 @@ void AssetListStorage::fetch_library(const AssetLibraryReference &library_refere
|
|||
void AssetListStorage::destruct()
|
||||
{
|
||||
global_storage().~AssetListMap();
|
||||
global_storage_is_destructed() = true;
|
||||
}
|
||||
|
||||
AssetList *AssetListStorage::lookup_list(const AssetLibraryReference &library_ref)
|
||||
|
@ -435,9 +437,19 @@ std::tuple<AssetList &, AssetListStorage::is_new_t> AssetListStorage::ensure_lis
|
|||
AssetListStorage::AssetListMap &AssetListStorage::global_storage()
|
||||
{
|
||||
static AssetListMap global_storage_;
|
||||
if (global_storage_is_destructed()) {
|
||||
global_storage_ = AssetListMap();
|
||||
global_storage_is_destructed() = false;
|
||||
}
|
||||
return global_storage_;
|
||||
}
|
||||
|
||||
bool &AssetListStorage::global_storage_is_destructed()
|
||||
{
|
||||
static bool is_destructed = false;
|
||||
return is_destructed;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
} // namespace blender::ed::asset
|
||||
|
|
|
@ -621,6 +621,10 @@ static void wm_file_read_pre(bContext *C, bool use_data, bool UNUSED(use_userdef
|
|||
UI_view2d_zoom_cache_reset();
|
||||
|
||||
ED_preview_restart_queue_free();
|
||||
/* #AssetLibraryService and the contained #AssetLibrary instances are destroyed on file loading.
|
||||
* Asset lists may still reference them, so clear the asset list storage entirely for now. Later
|
||||
* on, asset lists should actually live in the library, so this can be solved differently. */
|
||||
ED_assetlist_storage_exit();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue