diff options
author | Julian Eisel <julian@blender.org> | 2021-10-07 17:15:39 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-10-07 17:29:02 +0300 |
commit | c7b237e7d1a4c2adf03d5b7dc97b87691e6e224b (patch) | |
tree | a46678402152841d96376063b8313fc58e5e58a0 /source/blender/editors | |
parent | 9f9e2dd25d70d81a8ea9cd9164c1b221398cbaee (diff) |
Asset Browser: Move Asset Library selector to navigation bar
The menu to select the active Asset Library is now in the left bar (so called
"Source List", although I'd prefer "Navigation-Bar").
This has some benefits:
* All Asset Library navigation is in the left sidebar now, giving nice grouping
and a top-to-bottom & left-to-right flow of the layout. The header is focused
on view set-up now.
* Catalogs are stored inside the asset library. Makes sense to have them right
under that.
* Less content in the header allows for less wide Asset Browsers without
extensive scrolling.
* This location gives more space to add options or operators for Asset
Libraries.
Main downside I see is that the side-bar needs to be opened to change
libraries, which takes quite some space. In practice there shouldn't be need to
do this often though.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_file/asset_catalog_tree_view.cc | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_panels.c | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/asset_catalog_tree_view.cc b/source/blender/editors/space_file/asset_catalog_tree_view.cc index 84bfa58be85..28d64cfca60 100644 --- a/source/blender/editors/space_file/asset_catalog_tree_view.cc +++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc @@ -479,6 +479,8 @@ void file_create_asset_catalog_tree_view_in_layout(::AssetLibrary *asset_library { uiBlock *block = uiLayoutGetBlock(layout); + UI_block_layout_set_current(block, layout); + ui::AbstractTreeView *tree_view = UI_block_add_view( *block, "asset catalog tree view", diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index b530f1d0aa7..51d0581d6a4 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -232,13 +232,27 @@ void file_execute_region_panels_register(ARegionType *art) static void file_panel_asset_catalog_buttons_draw(const bContext *C, Panel *panel) { + bScreen *screen = CTX_wm_screen(C); SpaceFile *sfile = CTX_wm_space_file(C); /* May be null if the library wasn't loaded yet. */ struct AssetLibrary *asset_library = filelist_asset_library(sfile->files); FileAssetSelectParams *params = ED_fileselect_get_asset_params(sfile); BLI_assert(params != NULL); - file_create_asset_catalog_tree_view_in_layout(asset_library, panel->layout, sfile, params); + uiLayout *col = uiLayoutColumn(panel->layout, false); + uiLayout *row = uiLayoutRow(col, true); + + PointerRNA params_ptr; + RNA_pointer_create(&screen->id, &RNA_FileAssetSelectParams, params, ¶ms_ptr); + + uiItemR(row, ¶ms_ptr, "asset_library_ref", 0, "", ICON_NONE); + if (params->asset_library_ref.type != ASSET_LIBRARY_LOCAL) { + uiItemO(row, "", ICON_FILE_REFRESH, "FILE_OT_refresh"); + } + + uiItemS(col); + + file_create_asset_catalog_tree_view_in_layout(asset_library, col, sfile, params); } void file_tools_region_panels_register(ARegionType *art) |