[Bf-blender-cvs] [c7a500e3a0f] master: Asset Browser UI: Changes to the sidebar layout

Julian Eisel noreply at git.blender.org
Wed Dec 16 12:11:28 CET 2020


Commit: c7a500e3a0fa0721eb1771a422b6b17255692843
Author: Julian Eisel
Date:   Wed Dec 16 11:24:22 2020 +0100
Branches: master
https://developer.blender.org/rBc7a500e3a0fa0721eb1771a422b6b17255692843

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.

===================================================================

M	release/scripts/startup/bl_ui/space_filebrowser.py

===================================================================

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,



More information about the Bf-blender-cvs mailing list