[Bf-blender-cvs] [3a9cce31b44] asset-browser: Smaller UI tweaks for repository selection
Julian Eisel
noreply at git.blender.org
Thu Oct 1 19:05:39 CEST 2020
Commit: 3a9cce31b441295af4e619256ec3c65378ca6f43
Author: Julian Eisel
Date: Thu Oct 1 19:03:46 2020 +0200
Branches: asset-browser
https://developer.blender.org/rB3a9cce31b441295af4e619256ec3c65378ca6f43
Smaller UI tweaks for repository selection
* Rename "Local" to "Current File"
* Better separate built-in and custom repositories. Use columns with
headings "Custom" and "Built-in".
* Add separator before repository selector.
===================================================================
M release/scripts/startup/bl_ui/space_filebrowser.py
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 4d8d9dad972..93e92e64164 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -36,6 +36,8 @@ class FILEBROWSER_HT_header(Header):
FILEBROWSER_MT_editor_menus.draw_collapsible(context, layout)
if panel_poll_is_asset_browsing(context):
+ layout.separator()
+
layout.prop(params, "asset_repository", text="")
# can be None when save/reload with a file selector open
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 0a9082c9119..2db313f6b26 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2435,17 +2435,25 @@ static void rna_FileSelectParams_asset_repository_set(PointerRNA *ptr, int value
static const EnumPropertyItem *rna_FileSelectParams_asset_repository_itemf(
bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
{
- static const EnumPropertyItem predefined_items[] = {
+ const EnumPropertyItem predefined_items[] = {
/* For the future. */
// {FILE_ASSET_REPO_BUNDLED, "BUNDLED", 0, "Bundled", "Show the default user assets"},
- {FILE_ASSET_REPO_LOCAL, "LOCAL", 0, "Local", "Show the assets in the current file"},
+ {FILE_ASSET_REPO_LOCAL,
+ "LOCAL",
+ ICON_BLENDER,
+ "Current File",
+ "Show the assets currently available in this Blender session"},
{0, NULL, 0, NULL, NULL},
};
EnumPropertyItem *item = NULL;
int totitem = 0;
- RNA_enum_items_add(&item, &totitem, predefined_items);
+ /* Add separator if needed. */
+ if (!BLI_listbase_is_empty(&U.asset_repositories)) {
+ const EnumPropertyItem sepr = {0, "", 0, "Custom", NULL};
+ RNA_enum_item_add(&item, &totitem, &sepr);
+ }
int i = 0;
for (bUserAssetRepository *user_repository = U.asset_repositories.first; user_repository;
@@ -2465,6 +2473,14 @@ static const EnumPropertyItem *rna_FileSelectParams_asset_repository_itemf(
RNA_enum_item_add(&item, &totitem, &tmp);
}
+ if (totitem) {
+ const EnumPropertyItem sepr = {0, "", 0, "Built-in", NULL};
+ RNA_enum_item_add(&item, &totitem, &sepr);
+ }
+
+ /* Add predefined items. */
+ RNA_enum_items_add(&item, &totitem, predefined_items);
+
RNA_enum_item_end(&item, &totitem);
*r_free = true;
return item;
More information about the Bf-blender-cvs
mailing list