Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/blender_default.py25
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py9
-rw-r--r--release/scripts/startup/bl_ui/space_filebrowser.py354
3 files changed, 324 insertions, 64 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index ae2d2952f85..7cbea843ae8 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1771,6 +1771,11 @@ def km_file_browser(_params):
)
items.extend([
+ *_template_space_region_type_toggle(
+ toolbar_key={"type": 'T', "value": 'PRESS'},
+ ),
+ ("screen.region_toggle", {"type": 'N', "value": 'PRESS'},
+ {"properties": [("region_type", 'TOOL_PROPS')]}),
("file.parent", {"type": 'UP_ARROW', "value": 'PRESS', "alt": True}, None),
("file.previous", {"type": 'LEFT_ARROW', "value": 'PRESS', "alt": True}, None),
("file.next", {"type": 'RIGHT_ARROW', "value": 'PRESS', "alt": True}, None),
@@ -1782,7 +1787,6 @@ def km_file_browser(_params):
{"properties": [("data_path", 'space_data.params.show_hidden')]}),
("file.directory_new", {"type": 'I', "value": 'PRESS'}, None),
("file.smoothscroll", {"type": 'TIMER1', "value": 'ANY', "any": True}, None),
- ("file.bookmark_toggle", {"type": 'T', "value": 'PRESS'}, None),
("file.bookmark_add", {"type": 'B', "value": 'PRESS', "ctrl": True}, None),
])
@@ -1801,17 +1805,13 @@ def km_file_browser_main(params):
("file.execute", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'},
{"properties": [("need_active", True)]}),
("file.refresh", {"type": 'NUMPAD_PERIOD', "value": 'PRESS'}, None),
- ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK'}, None),
- ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},
+ ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK'},
+ {"properties": [("open", False)]}),
+ ("file.select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
+ ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True},
{"properties": [("extend", True)]}),
- ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True, "ctrl": True},
+ ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},
{"properties": [("extend", True), ("fill", True)]}),
- ("file.select", {"type": 'RIGHTMOUSE', "value": 'CLICK'},
- {"properties": [("open", False)]}),
- ("file.select", {"type": 'RIGHTMOUSE', "value": 'CLICK', "shift": True},
- {"properties": [("extend", True), ("open", False)]}),
- ("file.select", {"type": 'RIGHTMOUSE', "value": 'CLICK', "alt": True},
- {"properties": [("extend", True), ("fill", True), ("open", False)]}),
("file.select_walk", {"type": 'UP_ARROW', "value": 'PRESS'},
{"properties": [("direction", 'UP')]}),
("file.select_walk", {"type": 'UP_ARROW', "value": 'PRESS', "shift": True},
@@ -1843,8 +1843,11 @@ def km_file_browser_main(params):
("file.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None),
("file.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY', "shift": True},
{"properties": [("mode", 'ADD')]}),
- ("file.rename", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
+ ("file.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY', "ctrl": True},
+ {"properties": [("mode", 'SUB')]}),
("file.highlight", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None),
+ ("file.sort_column_ui_context", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
+ op_menu("FILEBROWSER_MT_context_menu", params.context_menu_event),
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
{"properties": [("increment", 1)]}),
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index 20f496adea9..1125ddb3d8c 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -1196,10 +1196,11 @@ def km_file_browser_main(params):
("file.execute", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'},
{"properties": [("need_active", True)]}),
("file.refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
- ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK'}, None),
- ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},
+ ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK'},
+ {"properties": [("open", False)]}),
+ ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True},
{"properties": [("extend", True)]}),
- ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True, "ctrl": True},
+ ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True,},
{"properties": [("extend", True), ("fill", True)]}),
("file.select", {"type": 'RIGHTMOUSE', "value": 'CLICK'},
{"properties": [("open", False)]}),
@@ -1239,6 +1240,8 @@ def km_file_browser_main(params):
("file.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY', "shift": True},
{"properties": [("mode", 'ADD')]}),
("file.highlight", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None),
+ ("file.sort_column_ui_context", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
+ op_menu("FILEBROWSER_MT_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
{"properties": [("increment", 1)]}),
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index b939586ff81..e9c11301909 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -34,58 +34,131 @@ class FILEBROWSER_HT_header(Header):
layout.menu("FILEBROWSER_MT_view")
- row = layout.row(align=True)
- row.operator("file.previous", text="", icon='BACK')
- row.operator("file.next", text="", icon='FORWARD')
- row.operator("file.parent", text="", icon='FILE_PARENT')
- row.operator("file.refresh", text="", icon='FILE_REFRESH')
+ # can be None when save/reload with a file selector open
- layout.operator_context = 'EXEC_DEFAULT'
- layout.operator("file.directory_new", icon='NEWFOLDER', text="")
+ layout.separator_spacer()
- layout.operator_context = 'INVOKE_DEFAULT'
+ layout.template_running_jobs()
+
+
+class FILEBROWSER_PT_display(Panel):
+ bl_space_type = 'FILE_BROWSER'
+ bl_region_type = 'HEADER'
+ bl_label = "Display"
+ @classmethod
+ def poll(cls, context):
# can be None when save/reload with a file selector open
- if params:
- is_lib_browser = params.use_library_browsing
+ return context.space_data.params is not None
- 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')
+ def draw(self, context):
+ layout = self.layout
- layout.separator_spacer()
+ space = context.space_data
+ params = space.params
+ is_lib_browser = params.use_library_browsing
- layout.template_running_jobs()
+ layout.label(text="Display as")
+ layout.column().prop(params, "display_type", expand=True)
- if params:
- layout.prop(params, "use_filter", text="", icon='FILTER')
+ layout.use_property_split = True
+ layout.use_property_decorate = False # No animation.
- row = layout.row(align=True)
- row.active = params.use_filter
- row.prop(params, "use_filter_folder", text="")
+ if params.display_type == 'THUMBNAIL':
+ layout.prop(params, "display_size", text="Size")
+ else:
+ layout.prop(params, "show_details_size", text="Size")
+ layout.prop(params, "show_details_datetime", text="Date")
- 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="")
+ layout.prop(params, "recursion_level", text="Recursions")
- 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="")
+ layout.use_property_split = False
+ layout.separator()
+
+ layout.label(text="Sort by")
+ layout.column().prop(params, "sort_method", expand=True)
+ layout.prop(params, "use_sort_invert")
- row.separator()
- row.prop(params, "filter_search", text="", icon='VIEWZOOM')
+
+class FILEBROWSER_PT_filter(Panel):
+ bl_space_type = 'FILE_BROWSER'
+ bl_region_type = 'HEADER'
+ bl_label = "Filter"
+
+ @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
+
+ space = context.space_data
+ params = space.params
+ is_lib_browser = params.use_library_browsing
+
+ row = layout.row(align=True)
+ row.prop(params, "use_filter", text="", toggle=0)
+ row.label(text="Filter")
+
+ col = layout.column()
+ col.active = params.use_filter
+
+ row = col.row()
+ row.label(icon='FILE_FOLDER')
+ row.prop(params, "use_filter_folder", text="Folders", toggle=0)
+
+ if params.filter_glob:
+ col.label(text=params.filter_glob)
+ else:
+ row = col.row()
+ row.label(icon='FILE_BLEND')
+ row.prop(params, "use_filter_blender",
+ text=".blend Files", toggle=0)
+ row = col.row()
+ row.label(icon='FILE_BACKUP')
+ row.prop(params, "use_filter_backup",
+ text="Backup .blend Files", toggle=0)
+ row = col.row()
+ row.label(icon='FILE_IMAGE')
+ row.prop(params, "use_filter_image", text="Image Files", toggle=0)
+ row = col.row()
+ row.label(icon='FILE_MOVIE')
+ row.prop(params, "use_filter_movie", text="Movie Files", toggle=0)
+ row = col.row()
+ row.label(icon='FILE_SCRIPT')
+ row.prop(params, "use_filter_script",
+ text="Script Files", toggle=0)
+ row = col.row()
+ row.label(icon='FILE_FONT')
+ row.prop(params, "use_filter_font", text="Font Files", toggle=0)
+ row = col.row()
+ row.label(icon='FILE_SOUND')
+ row.prop(params, "use_filter_sound", text="Sound Files", toggle=0)
+ row = col.row()
+ row.label(icon='FILE_TEXT')
+ row.prop(params, "use_filter_text", text="Text Files", toggle=0)
+
+ col.separator()
+
+ if is_lib_browser:
+ row = col.row()
+ row.label(icon='BLANK1') # Indentation
+ row.prop(params, "use_filter_blendid",
+ text="Blender IDs", toggle=0)
+ if params.use_filter_blendid:
+ row = col.row()
+ row.label(icon='BLANK1') # Indentation
+ row.prop(params, "filter_id_category", text="")
+
+ col.separator()
+
+ layout.prop(params, "show_hidden")
+
+
+def panel_poll_is_upper_region(region):
+ # The upper region is left-aligned, the lower is split into it then.
+ return region.alignment == 'LEFT'
class FILEBROWSER_UL_dir(UIList):
@@ -119,10 +192,13 @@ class FILEBROWSER_UL_dir(UIList):
class FILEBROWSER_PT_bookmarks_volumes(Panel):
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'TOOLS'
- bl_options = {'DEFAULT_CLOSED'}
bl_category = "Bookmarks"
bl_label = "Volumes"
+ @classmethod
+ def poll(cls, context):
+ return panel_poll_is_upper_region(context.region)
+
def draw(self, context):
layout = self.layout
space = context.space_data
@@ -141,7 +217,7 @@ class FILEBROWSER_PT_bookmarks_system(Panel):
@classmethod
def poll(cls, context):
- return not context.preferences.filepaths.hide_system_bookmarks
+ return not context.preferences.filepaths.hide_system_bookmarks and panel_poll_is_upper_region(context.region)
def draw(self, context):
layout = self.layout
@@ -161,8 +237,10 @@ class FILEBROWSER_MT_bookmarks_context_menu(Menu):
layout.operator("file.bookmark_cleanup", icon='X', text="Cleanup")
layout.separator()
- layout.operator("file.bookmark_move", icon='TRIA_UP_BAR', text="Move To Top").direction = 'TOP'
- layout.operator("file.bookmark_move", icon='TRIA_DOWN_BAR', text="Move To Bottom").direction = 'BOTTOM'
+ layout.operator("file.bookmark_move", icon='TRIA_UP_BAR',
+ text="Move To Top").direction = 'TOP'
+ layout.operator("file.bookmark_move", icon='TRIA_DOWN_BAR',
+ text="Move To Bottom").direction = 'BOTTOM'
class FILEBROWSER_PT_bookmarks_favorites(Panel):
@@ -171,6 +249,10 @@ class FILEBROWSER_PT_bookmarks_favorites(Panel):
bl_category = "Bookmarks"
bl_label = "Favorites"
+ @classmethod
+ def poll(cls, context):
+ return panel_poll_is_upper_region(context.region)
+
def draw(self, context):
layout = self.layout
space = context.space_data
@@ -185,12 +267,15 @@ class FILEBROWSER_PT_bookmarks_favorites(Panel):
col = row.column(align=True)
col.operator("file.bookmark_add", icon='ADD', text="")
col.operator("file.bookmark_delete", icon='REMOVE', text="")
- col.menu("FILEBROWSER_MT_bookmarks_context_menu", icon='DOWNARROW_HLT', text="")
+ col.menu("FILEBROWSER_MT_bookmarks_context_menu",
+ icon='DOWNARROW_HLT', text="")
if num_rows > 1:
col.separator()
- col.operator("file.bookmark_move", icon='TRIA_UP', text="").direction = 'UP'
- col.operator("file.bookmark_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
+ col.operator("file.bookmark_move", icon='TRIA_UP',
+ text="").direction = 'UP'
+ col.operator("file.bookmark_move", icon='TRIA_DOWN',
+ text="").direction = 'DOWN'
else:
layout.operator("file.bookmark_add", icon='ADD')
@@ -203,7 +288,7 @@ class FILEBROWSER_PT_bookmarks_recents(Panel):
@classmethod
def poll(cls, context):
- return not context.preferences.filepaths.hide_recent_locations
+ return not context.preferences.filepaths.hide_recent_locations and panel_poll_is_upper_region(context.region)
def draw(self, context):
layout = self.layout
@@ -227,7 +312,7 @@ class FILEBROWSER_PT_advanced_filter(Panel):
@classmethod
def poll(cls, context):
# only useful in append/link (library) context currently...
- return context.space_data.params.use_library_browsing
+ return context.space_data.params.use_library_browsing and panel_poll_is_upper_region(context.region)
def draw(self, context):
layout = self.layout
@@ -242,6 +327,133 @@ class FILEBROWSER_PT_advanced_filter(Panel):
col.prop(params, "filter_id")
+class FILEBROWSER_PT_options_toggle(Panel):
+ bl_space_type = 'FILE_BROWSER'
+ bl_region_type = 'TOOLS'
+ bl_label = "Options Toggle"
+ bl_options = {'HIDE_HEADER'}
+
+ @classmethod
+ def poll(cls, context):
+ sfile = context.space_data
+ return context.region.alignment == 'BOTTOM' and sfile.active_operator
+
+ def is_option_region_visible(self, context):
+ for region in context.area.regions:
+ if region.type == 'TOOL_PROPS' and region.width <= 1:
+ return False
+
+ return True
+
+ def draw(self, context):
+ layout = self.layout
+ label = "Hide Options" if self.is_option_region_visible(
+ context) else "Options"
+
+ layout.scale_x = 1.3
+ layout.scale_y = 1.3
+
+ layout.operator("screen.region_toggle",
+ text=label).region_type = 'TOOL_PROPS'
+
+
+class FILEBROWSER_PT_directory_path(Panel):
+ bl_space_type = 'FILE_BROWSER'
+ bl_region_type = 'UI'
+ bl_label = "Directory Path"
+ bl_category = "Attributes"
+ 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
+ params = space.params
+
+ layout.scale_x = 1.3
+ layout.scale_y = 1.3
+
+ row = layout.row()
+
+ subrow = row.row(align=True)
+ subrow.operator("file.previous", text="", icon='BACK')
+ subrow.operator("file.next", text="", icon='FORWARD')
+ subrow.operator("file.parent", text="", icon='FILE_PARENT')
+ subrow.operator("file.refresh", text="", icon='FILE_REFRESH')
+
+ row.operator("file.directory_new", icon='NEWFOLDER', text="")
+
+ subrow = row.row()
+ subrow.prop(params, "directory", text="")
+
+ subrow = row.row()
+ subrow.scale_x = 0.5
+ subrow.prop(params, "filter_search", text="", icon='VIEWZOOM')
+
+ # Uses prop_with_popover() as popover() only adds the triangle icon in headers.
+ row.prop_with_popover(
+ params,
+ "display_type",
+ panel="FILEBROWSER_PT_display",
+ text="",
+ icon_only=True,
+ )
+ row.prop_with_popover(
+ params,
+ "display_type",
+ panel="FILEBROWSER_PT_filter",
+ text="",
+ icon='FILTER',
+ icon_only=True,
+ )
+
+
+class FILEBROWSER_PT_file_operation(Panel):
+ bl_space_type = 'FILE_BROWSER'
+ bl_region_type = 'EXECUTE'
+ bl_label = "Execute File Operation"
+ bl_options = {'HIDE_HEADER'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.space_data.active_operator
+
+ def draw(self, context):
+ import sys
+
+ layout = self.layout
+ space = context.space_data
+ params = space.params
+
+ layout.scale_x = 1.3
+ layout.scale_y = 1.3
+
+ row = layout.row()
+ sub = row.row()
+ sub.prop(params, "filename", text="")
+ sub = row.row()
+ sub.ui_units_x = 5
+
+ # subsub = sub.row(align=True)
+ # subsub.operator("file.filenum", text="", icon='ADD').increment = 1
+ # subsub.operator("file.filenum", text="", icon='REMOVE').increment = -1
+
+ # organize buttons according to the OS standard
+ if sys.platform != "win":
+ sub.operator("FILE_OT_cancel", text="Cancel")
+ subsub = sub.row()
+ subsub.active_default = True
+ subsub.operator("FILE_OT_execute", text=params.title)
+ if sys.platform == "win":
+ sub.operator("FILE_OT_cancel", text="Cancel")
+
+
class FILEBROWSER_MT_view(Menu):
bl_label = "View"
@@ -250,7 +462,7 @@ class FILEBROWSER_MT_view(Menu):
st = context.space_data
params = st.params
- layout.prop(st, "show_region_toolbar")
+ layout.prop(st, "show_region_toolbar", text="Source List")
layout.prop(st, "show_region_ui", text="File Path")
layout.separator()
@@ -263,8 +475,46 @@ class FILEBROWSER_MT_view(Menu):
layout.menu("INFO_MT_area")
+class FILEBROWSER_MT_context_menu(Menu):
+ bl_label = "Files Context Menu"
+
+ def draw(self, context):
+ layout = self.layout
+ st = context.space_data
+ params = st.params
+
+ layout.operator("file.previous", text="Back")
+ layout.operator("file.next", text="Forward")
+ layout.operator("file.parent", text="Go to Parent")
+ layout.operator("file.refresh", text="Refresh")
+
+ layout.separator()
+
+ layout.operator("file.filenum", text="Increase Number",
+ icon='ADD').increment = 1
+ layout.operator("file.filenum", text="Decrease Number",
+ icon='REMOVE').increment = -1
+
+ layout.separator()
+
+ layout.operator("file.rename", text="Rename")
+ # layout.operator("file.delete")
+ layout.operator("file.directory_new", text="New Folder")
+ layout.operator("file.bookmark_add", text="Add Bookmark")
+
+ layout.separator()
+
+ layout.prop_menu_enum(params, "display_type")
+ if params.display_type == 'THUMBNAIL':
+ layout.prop_menu_enum(params, "display_size")
+ layout.prop_menu_enum(params, "recursion_level", text="Recursions")
+ layout.prop_menu_enum(params, "sort_method")
+
+
classes = (
FILEBROWSER_HT_header,
+ FILEBROWSER_PT_display,
+ FILEBROWSER_PT_filter,
FILEBROWSER_UL_dir,
FILEBROWSER_PT_bookmarks_volumes,
FILEBROWSER_PT_bookmarks_system,
@@ -272,7 +522,11 @@ classes = (
FILEBROWSER_PT_bookmarks_favorites,
FILEBROWSER_PT_bookmarks_recents,
FILEBROWSER_PT_advanced_filter,
+ FILEBROWSER_PT_directory_path,
+ FILEBROWSER_PT_file_operation,
+ FILEBROWSER_PT_options_toggle,
FILEBROWSER_MT_view,
+ FILEBROWSER_MT_context_menu,
)
if __name__ == "__main__": # only for live edit.