[Bf-blender-cvs] [ceb049133c6] master: Asset Browser: Don't show inapplicable filter and display settings

Julian Eisel noreply at git.blender.org
Mon Aug 2 17:00:32 CEST 2021


Commit: ceb049133c6fe7e66e67227c5f8fde311e69aa14
Author: Julian Eisel
Date:   Mon Aug 2 16:50:04 2021 +0200
Branches: master
https://developer.blender.org/rBceb049133c6fe7e66e67227c5f8fde311e69aa14

Asset Browser: Don't show inapplicable filter and display settings

So far the Asset Browser just showed the same popups and settings as the
File Browser. Not all of them made sense for the Asset Browser though.

* Don't show inapplicable recursion toggle.
* Don't show sorting options, which don't work with assets anyway.
* Don't show the Filter popover, there are currently no applicable items
  in there.

Just like in D12057, I decided to add separate classes for the Asset
Browser case.

Differential Revision: https://developer.blender.org/D12059

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

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 570d8b42821..81a71ea0de2 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -52,18 +52,10 @@ class FILEBROWSER_HT_header(Header):
         layout.prop_with_popover(
             params,
             "display_type",
-            panel="FILEBROWSER_PT_display",
+            panel="ASSETBROWSER_PT_display",
             text="",
             icon_only=True,
         )
-        layout.prop_with_popover(
-            params,
-            "display_type",
-            panel="FILEBROWSER_PT_filter",
-            text="",
-            icon='FILTER',
-            icon_only=True,
-        )
 
         layout.prop(params, "filter_search", text="", icon='VIEWZOOM')
 
@@ -96,16 +88,24 @@ class FILEBROWSER_HT_header(Header):
             layout.template_running_jobs()
 
 
-class FILEBROWSER_PT_display(Panel):
+class FileBrowserPanel:
     bl_space_type = 'FILE_BROWSER'
-    bl_region_type = 'HEADER'
-    bl_label = "Display Settings"  # Shows as tooltip in popover
-    bl_ui_units_x = 10
 
     @classmethod
     def poll(cls, context):
+        space_data = context.space_data
+
         # can be None when save/reload with a file selector open
-        return context.space_data.params is not None
+        if space_data.params is None:
+            return False
+
+        return space_data and space_data.type == 'FILE_BROWSER' and space_data.browse_mode == 'FILES'
+
+
+class FILEBROWSER_PT_display(FileBrowserPanel, Panel):
+    bl_region_type = 'HEADER'
+    bl_label = "Display Settings"  # Shows as tooltip in popover
+    bl_ui_units_x = 10
 
     def draw(self, context):
         layout = self.layout
@@ -129,17 +129,11 @@ class FILEBROWSER_PT_display(Panel):
         layout.prop(params, "use_sort_invert")
 
 
-class FILEBROWSER_PT_filter(Panel):
-    bl_space_type = 'FILE_BROWSER'
+class FILEBROWSER_PT_filter(FileBrowserPanel, Panel):
     bl_region_type = 'HEADER'
     bl_label = "Filter Settings"  # Shows as tooltip in popover
     bl_ui_units_x = 8
 
-    @classmethod
-    def poll(cls, context):
-        # can be None when save/reload with a file selector open
-        return context.space_data.params is not None
-
     def draw(self, context):
         layout = self.layout
 
@@ -579,6 +573,28 @@ class FILEBROWSER_MT_context_menu(Menu):
         layout.prop_menu_enum(params, "sort_method")
 
 
+class ASSETBROWSER_PT_display(asset_utils.AssetBrowserPanel, Panel):
+    bl_region_type = 'HEADER'
+    bl_label = "Display Settings"  # Shows as tooltip in popover
+    bl_ui_units_x = 10
+
+    def draw(self, context):
+        layout = self.layout
+
+        space = context.space_data
+        params = space.params
+
+        layout.use_property_split = True
+        layout.use_property_decorate = False  # No animation.
+
+        if params.display_type == 'THUMBNAIL':
+            layout.prop(params, "display_size", text="Size")
+        else:
+            col = layout.column(heading="Columns", align=True)
+            col.prop(params, "show_details_size", text="Size")
+            col.prop(params, "show_details_datetime", text="Date")
+
+
 class AssetBrowserMenu:
     @classmethod
     def poll(cls, context):
@@ -755,6 +771,7 @@ classes = (
     FILEBROWSER_MT_view,
     FILEBROWSER_MT_select,
     FILEBROWSER_MT_context_menu,
+    ASSETBROWSER_PT_display,
     ASSETBROWSER_MT_editor_menus,
     ASSETBROWSER_MT_view,
     ASSETBROWSER_MT_select,



More information about the Bf-blender-cvs mailing list