blender/release/ui/space_filebrowser.py
Dalai Felinto cfd5046c9e 2.5 filebrowser: previous/next + bugfix + elubie's changes and cleanup
* Previous/Next Folder browser
* bugfix: "open most recently opened directory".

* Previous and Next functionalities:
- use BACKSPACE to navigate to previous folders
- use SHIFT+BACKSPACE to navigate forward
- once you change the folder by other ways the forward folder list is cleared

* bug fix: the sfile->params->dir set through ED_fileselect_set_params wasn't correct. According to the code taking the settings from the existing (previous) filebrowser is a temp solution. In that case this is a fix for a temp solution :)
(changes in: wm_event_system.c, filesel.c and ED_fileselect.h)

** Andrea(elubie): we can get away of the folderlist_clear_next test if we manually pass a boolean to file_change_dir (e.g. file_change_dir(sfile, true)). I tried not to mess up with your changes here. It's slightly slower (and maybe hacky) but its's more conservative IMHO.

(my first commit to 2.5 ... that was a good reason to put my paper on hold :p)
2009-07-07 07:25:44 +00:00

68 lines
2.0 KiB
Python

import bpy
class FILEBROWSER_HT_header(bpy.types.Header):
__space_type__ = "FILE_BROWSER"
__idname__ = "FILEBROWSER_HT_header"
def draw(self, context):
st = context.space_data
layout = self.layout
params = st.params
layout.template_header()
if context.area.show_menus:
row = layout.row()
row.itemM("FILEBROWSER_MT_directory")
row.itemM("FILEBROWSER_MT_bookmarks")
row = layout.row(align=True)
row.itemO("FILE_OT_parent", text="", icon='ICON_FILE_PARENT')
row.itemO("FILE_OT_refresh", text="", icon='ICON_FILE_REFRESH')
row.itemO("FILE_OT_previous", text="", icon='ICON_PREV_KEYFRAME')
row.itemO("FILE_OT_next", text="", icon='ICON_NEXT_KEYFRAME')
layout.itemR(params, "display", expand=True, text="")
layout.itemR(params, "sort", expand=True, text="")
layout.itemR(params, "hide_dot")
layout.itemR(params, "do_filter")
row = layout.row(align=True)
row.itemR(params, "filter_folder", text="");
row.itemR(params, "filter_blender", text="");
row.itemR(params, "filter_image", text="");
row.itemR(params, "filter_movie", text="");
row.itemR(params, "filter_script", text="");
row.itemR(params, "filter_font", text="");
row.itemR(params, "filter_sound", text="");
row.itemR(params, "filter_text", text="");
row.active = params.do_filter
class FILEBROWSER_MT_directory(bpy.types.Menu):
__space_type__ = "FILE_BROWSER"
__label__ = "Directory"
def draw(self, context):
layout = self.layout
layout.itemO("FILE_OT_refresh", text="Refresh", icon='ICON_FILE_REFRESH')
layout.itemO("FILE_OT_parent", text="Parent", icon='ICON_FILE_PARENT')
class FILEBROWSER_MT_bookmarks(bpy.types.Menu):
__space_type__ = "FILE_BROWSER"
__label__ = "Bookmarks"
def draw(self, context):
layout = self.layout
layout.itemO("FILE_OT_add_bookmark", text="Add current directory", icon='ICON_BOOKMARKS')
bpy.types.register(FILEBROWSER_HT_header)
bpy.types.register(FILEBROWSER_MT_directory)
bpy.types.register(FILEBROWSER_MT_bookmarks)