[Bf-blender-cvs] [4dbaa1bab32] filebrowser_redesign: Show view options in header if visible

Julian Eisel noreply at git.blender.org
Mon Jul 22 19:37:07 CEST 2019


Commit: 4dbaa1bab3201137de1464c40b8959b5391fe301
Author: Julian Eisel
Date:   Sun Jul 21 15:40:33 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rB4dbaa1bab3201137de1464c40b8959b5391fe301

Show view options in header if visible

Brings back most of the buttons that were previously in the header back
to it. When the header is visible, the filter (or better said display)
popup is hidden.

Also moves display type option into the filter/display popup.

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

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 29bcaf1973d..09495167c8b 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -34,10 +34,48 @@ class FILEBROWSER_HT_header(Header):
 
         layout.menu("FILEBROWSER_MT_view")
 
+        # can be None when save/reload with a file selector open
+        if params:
+            is_lib_browser = params.use_library_browsing
+
+            layout.prop(params, "display_type", expand=True, text="")
+            layout.prop(params, "sort_method", expand=True, text="")
+            layout.prop(params, "show_hidden", text="", icon='FILE_HIDDEN')
+
         layout.separator_spacer()
 
         layout.template_running_jobs()
 
+        if params:
+            layout.prop(params, "use_filter", text="", icon='FILTER')
+
+            row = layout.row(align=True)
+            row.active = params.use_filter
+            row.prop(params, "use_filter_folder", text="")
+
+            if params.filter_glob:
+                # if st.active_operator and hasattr(st.active_operator, "filter_glob"):
+                #     row.prop(params, "filter_glob", text="")
+                row.label(text=params.filter_glob)
+            else:
+                row.prop(params, "use_filter_blender", text="")
+                row.prop(params, "use_filter_backup", text="")
+                row.prop(params, "use_filter_image", text="")
+                row.prop(params, "use_filter_movie", text="")
+                row.prop(params, "use_filter_script", text="")
+                row.prop(params, "use_filter_font", text="")
+                row.prop(params, "use_filter_sound", text="")
+                row.prop(params, "use_filter_text", text="")
+
+            if is_lib_browser:
+                row.prop(params, "use_filter_blendid", text="")
+                if params.use_filter_blendid:
+                    row.separator()
+                    row.prop(params, "filter_id_category", text="")
+
+            row.separator()
+            row.prop(params, "filter_search", text="", icon='VIEWZOOM')
+
 
 class FILEBROWSER_PT_filter(Panel):
     bl_space_type = 'FILE_BROWSER'
@@ -57,6 +95,9 @@ class FILEBROWSER_PT_filter(Panel):
         params = space.params
         is_lib_browser = params.use_library_browsing
 
+        layout.label(text="Display Type:")
+        layout.prop(params, "display_type", expand=True, text="")
+
         layout.label(text="Sort By:")
         layout.prop(params, "sort_method", expand=True, text="")
 
@@ -288,6 +329,13 @@ class FILEBROWSER_PT_directory_path(Panel):
     bl_label = "Directory Path"
     bl_options = {'HIDE_HEADER'}
 
+    def is_header_visible(self, context):
+        for region in context.area.regions:
+            if region.type == 'HEADER' and region.height <= 1:
+                return False
+
+        return True
+
     def draw(self, context):
         layout = self.layout
         space = context.space_data
@@ -308,15 +356,13 @@ class FILEBROWSER_PT_directory_path(Panel):
         subrow = row.row()
         subrow.prop(params, "directory", text="")
 
-        subrow = row.row(align=True)
-        subrow.prop(params, "display_type", expand=True, text="")
-
         # TODO down triangle only created for UI_LAYOUT_HEADER
-        row.popover(
-            panel="FILEBROWSER_PT_filter",
-            text="",
-            icon='FILTER',
-        )
+        if self.is_header_visible(context) is False:
+            row.popover(
+                panel="FILEBROWSER_PT_filter",
+                text="",
+                icon='FILTER',
+            )
 
         subrow = row.row(align=True)
         subrow.operator("file.directory_new", icon='NEWFOLDER', text="")



More information about the Bf-blender-cvs mailing list