[Bf-blender-cvs] [cdfe2e1c3f1] master: UI: Add View pie to File Browser

Fynn Grotehans noreply at git.blender.org
Tue Aug 16 18:10:19 CEST 2022


Commit: cdfe2e1c3f1a13d6bbef0daec246aff475c4fca0
Author: Fynn Grotehans
Date:   Tue Aug 16 18:07:03 2022 +0200
Branches: master
https://developer.blender.org/rBcdfe2e1c3f1a13d6bbef0daec246aff475c4fca0

UI: Add View pie to File Browser

Adds a pie menu to the File Browser for convenient switching between vertical list, horizontal list and thumbnail view.

Uses the same shortcut as other View pie menus (`ACCENT_GRAVE`).

{F12811673}

Reviewed By: #user_interface, pablovazquez, Severin

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

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

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	release/scripts/startup/bl_ui/space_filebrowser.py

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

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index efc70f22321..c8569990a3a 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2234,6 +2234,7 @@ def km_file_browser(params):
          {"properties": [("increment", -10)]}),
         ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True},
          {"properties": [("increment", -100)]}),
+        op_menu_pie("FILEBROWSER_MT_view_pie", {"type": 'ACCENT_GRAVE', "value": 'PRESS'}),
 
         # Select file under cursor before spawning the context menu.
         ("file.select", {"type": 'RIGHTMOUSE', "value": 'PRESS'},
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 96ce731306f..1e7faf68b3f 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -566,6 +566,21 @@ class FILEBROWSER_MT_context_menu(FileBrowserMenu, Menu):
         layout.prop_menu_enum(params, "sort_method")
 
 
+class FILEBROWSER_MT_view_pie(Menu):
+    bl_label = "View"
+    bl_idname = "FILEBROWSER_MT_view_pie"
+
+    def draw(self, context):
+        layout = self.layout
+
+        pie = layout.menu_pie()
+        view = context.space_data
+
+        pie.prop_enum(view.params, "display_type", value='LIST_VERTICAL')
+        pie.prop_enum(view.params, "display_type", value='LIST_HORIZONTAL')
+        pie.prop_enum(view.params, "display_type", value='THUMBNAIL')
+
+
 class ASSETBROWSER_PT_display(asset_utils.AssetBrowserPanel, Panel):
     bl_region_type = 'HEADER'
     bl_label = "Display Settings"  # Shows as tooltip in popover
@@ -823,6 +838,7 @@ classes = (
     FILEBROWSER_MT_view,
     FILEBROWSER_MT_select,
     FILEBROWSER_MT_context_menu,
+    FILEBROWSER_MT_view_pie,
     ASSETBROWSER_PT_display,
     ASSETBROWSER_PT_filter,
     ASSETBROWSER_MT_editor_menus,



More information about the Bf-blender-cvs mailing list