WIP: Rewrite asset browser as separate editor #107576

Draft
Julian Eisel wants to merge 95 commits from asset-browser-frontend-split into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 16 additions and 0 deletions
Showing only changes of commit 9530fb60ad - Show all commits

View File

@ -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

View File

@ -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();
}
/**