diff options
author | Julian Eisel <julian@blender.org> | 2020-12-16 13:24:22 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-12-16 14:10:58 +0300 |
commit | c7a500e3a0fa0721eb1771a422b6b17255692843 (patch) | |
tree | dd5d83e7b3e439c45ada6a875d88f8b5abaef3f8 | |
parent | 19fc30c15fa50765a70f662e1aa78cd4140035ce (diff) |
Asset Browser UI: Changes to the sidebar layout
The current layout wasn't great at all, and it was planned to polish this. This
does a first round of improvements, some more tweaking may follow.
* Place name button at the top, with no panel and no leading label.
* Add "Preview" panel, people may not want to see the preview all the time,
it's already visible in the file list.
* Move button to browse for a custom preview to the right of the preview, as
icon-only. We have a similar layout in other places (UI-lists, matcaps).
* Don't make the details panel a sub-panel. Looked weird because the parent
doesn't have a header.
* Add info icon to "No asset selected", looks a bit friendlier.
* Minor cleanups in the UI script.
Based on designs and feedback by William Reynish.
-rw-r--r-- | release/scripts/startup/bl_ui/space_filebrowser.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index b6ca0639b4b..98368f304d9 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -588,24 +588,31 @@ class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel): active_file = context.active_file active_asset = asset_utils.SpaceAssetInfo.get_active_asset(context) - layout.use_property_split = True - if not active_file or not active_asset: - layout.label(text="No asset selected.") + layout.label(text="No asset selected.", icon='INFO') return - box = layout.box() + # If the active file is an ID, use its name directly so renaming is possible from right here. + layout.prop(context.id if not None else active_file, "name", text="") + + +class ASSETBROWSER_PT_metadata_preview(asset_utils.AssetMetaDataPanel, Panel): + bl_label = "Preview" + + def draw(self, context): + layout = self.layout + active_file = context.active_file + + row = layout.row() + box = row.box() box.template_icon(icon_value=active_file.preview_icon_id, scale=5.0) if bpy.ops.ed.lib_id_load_custom_preview.poll(): - box.operator("ed.lib_id_load_custom_preview", icon='FILEBROWSER', text="Load Custom") - # If the active file is an ID, use its name directly so renaming is possible from right here. - layout.prop(context.id if not None else active_file, "name") + col = row.column(align=True) + col.operator("ed.lib_id_load_custom_preview", icon='FILEBROWSER', text="") -class ASSETBROWSER_PT_metadata_details(asset_utils.AssetBrowserPanel, Panel): - bl_region_type = 'TOOL_PROPS' +class ASSETBROWSER_PT_metadata_details(asset_utils.AssetMetaDataPanel, Panel): bl_label = "Details" - bl_parent_id = "ASSETBROWSER_PT_metadata" def draw(self, context): layout = self.layout @@ -663,6 +670,7 @@ classes = ( FILEBROWSER_MT_context_menu, ASSETBROWSER_PT_navigation_bar, ASSETBROWSER_PT_metadata, + ASSETBROWSER_PT_metadata_preview, ASSETBROWSER_PT_metadata_details, ASSETBROWSER_PT_metadata_tags, ASSETBROWSER_UL_metadata_tags, |