diff options
author | Julian Eisel <julian@blender.org> | 2021-07-08 23:16:50 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-07-15 17:12:36 +0300 |
commit | 7898089de3f20b08a08516bd2fd2be7dd1c565fe (patch) | |
tree | ec3c1aebe9bb6926208dd5802a1f9af57302c326 /source/blender/makesrna/intern/rna_workspace.c | |
parent | 59f9a5e6ac6f5bff914204ef299cba27bb5016eb (diff) |
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.
Diffstat (limited to 'source/blender/makesrna/intern/rna_workspace.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_workspace.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c index 6b52a38c2da..15bdeae16b6 100644 --- a/source/blender/makesrna/intern/rna_workspace.c +++ b/source/blender/makesrna/intern/rna_workspace.c @@ -107,6 +107,18 @@ static void rna_WorkSpace_owner_ids_clear(WorkSpace *workspace) WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, workspace); } +static int rna_WorkSpace_active_asset_library_get(PointerRNA *ptr) +{ + const WorkSpace *workspace = ptr->data; + return rna_asset_library_reference_get(&workspace->active_asset_library); +} + +static void rna_WorkSpace_active_asset_library_set(PointerRNA *ptr, int value) +{ + WorkSpace *workspace = ptr->data; + rna_asset_library_reference_set(&workspace->active_asset_library, value); +} + static bToolRef *rna_WorkSpace_tools_from_tkey(WorkSpace *workspace, const bToolKey *tkey, bool create) @@ -407,6 +419,13 @@ static void rna_def_workspace(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use UI Tags", "Filter the UI by tags"); RNA_def_property_update(prop, 0, "rna_window_update_all"); + prop = rna_def_asset_library_reference_common( + srna, "rna_WorkSpace_active_asset_library_get", "rna_WorkSpace_active_asset_library_set"); + RNA_def_property_ui_text(prop, + "Asset Library", + "Active asset library to show in the UI, not used by the Asset Browser " + "(which has its own active asset library)"); + RNA_api_workspace(srna); } |