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.
This commit is contained in:
Julian Eisel 2020-12-16 11:24:22 +01:00
parent 19fc30c15f
commit c7a500e3a0
1 changed files with 18 additions and 10 deletions

View File

@ -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,