From 7898089de3f20b08a08516bd2fd2be7dd1c565fe Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 8 Jul 2021 22:16:50 +0200 Subject: Assets: Add an active asset library per workspace, for the UI to use This per-workspace active asset library will be used by the asset views later. Note that Asset Browsers have their own active asset library, overriding the one from the workspace. As part of this the `FileSelectAssetLibraryUID` type gets replaced by `AssetLibraryReference` which is on the asset level now, not the File/Asset Browser level. But some more work is needed to complete that, which is better done in a separate commit. This also moves the asset library from/to enum-value logic from RNA to the editor asset level, which will later be used by the asset view. --- source/blender/blenloader/intern/versioning_300.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 3c58c29c162..d36c622c572 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -33,9 +33,11 @@ #include "DNA_listBase.h" #include "DNA_modifier_types.h" #include "DNA_text_types.h" +#include "DNA_workspace_types.h" #include "BKE_action.h" #include "BKE_animsys.h" +#include "BKE_asset.h" #include "BKE_collection.h" #include "BKE_deform.h" #include "BKE_fcurve_driver.h" @@ -517,6 +519,15 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } FOREACH_NODETREE_END; + + { + if (!DNA_struct_elem_find( + fd->filesdna, "WorkSpace", "AssetLibraryReference", "active_asset_library")) { + LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) { + BKE_asset_library_reference_init_default(&workspace->active_asset_library); + } + } + } } if (!MAIN_VERSION_ATLEAST(bmain, 300, 10)) { -- cgit v1.2.3