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/blenkernel/intern/workspace.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/workspace.c') diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 533107b2bf6..5cac149c503 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -29,6 +29,7 @@ #include "BLT_translation.h" +#include "BKE_asset.h" #include "BKE_global.h" #include "BKE_idprop.h" #include "BKE_idtype.h" @@ -53,6 +54,13 @@ /* -------------------------------------------------------------------- */ +static void workspace_init_data(ID *id) +{ + WorkSpace *workspace = (WorkSpace *)id; + + BKE_asset_library_reference_init_default(&workspace->active_asset_library); +} + static void workspace_free_data(ID *id) { WorkSpace *workspace = (WorkSpace *)id; @@ -180,7 +188,7 @@ IDTypeInfo IDType_ID_WS = { .translation_context = BLT_I18NCONTEXT_ID_WORKSPACE, .flags = IDTYPE_FLAGS_NO_COPY | IDTYPE_FLAGS_NO_MAKELOCAL | IDTYPE_FLAGS_NO_ANIMDATA, - .init_data = NULL, + .init_data = workspace_init_data, .copy_data = NULL, .free_data = workspace_free_data, .make_local = NULL, -- cgit v1.2.3