[Bf-blender-cvs] [c7b237e7d1a] master: Asset Browser: Move Asset Library selector to navigation bar
Julian Eisel
noreply at git.blender.org
Thu Oct 7 16:29:58 CEST 2021
Commit: c7b237e7d1a4c2adf03d5b7dc97b87691e6e224b
Author: Julian Eisel
Date: Thu Oct 7 16:15:39 2021 +0200
Branches: master
https://developer.blender.org/rBc7b237e7d1a4c2adf03d5b7dc97b87691e6e224b
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.
===================================================================
M release/scripts/startup/bl_ui/space_filebrowser.py
M source/blender/editors/space_file/asset_catalog_tree_view.cc
M source/blender/editors/space_file/file_panels.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 5dd8c69f3d5..f54a2446c7e 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -36,12 +36,6 @@ class FILEBROWSER_HT_header(Header):
space_data = context.space_data
params = space_data.params
- row = layout.row(align=True)
- row.prop(params, "asset_library_ref", text="")
- # External libraries don't auto-refresh, add refresh button.
- if params.asset_library_ref != 'LOCAL':
- row.operator("file.refresh", text="", icon='FILE_REFRESH')
-
layout.separator_spacer()
layout.prop(params, "import_type", text="")
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)
More information about the Bf-blender-cvs
mailing list