Final 'FileBrowser First Stage' merge.
It basically rewrites most of filelist.c, with some more limited changes in other areas of filebrowser. From user perspective, it: * Removes some info in 'long' drawing mode (owner, permissions) - OS-specific data that do not really matter in Blender! * Makes short/long display 'fixed' size (among four choices, like thumbnails mode). * Allows to list several layers of dirtree at once, in a flat way (inside .blend files and/or real directories). * Consequently, adds datablocks types filtering. * Uses way less RAM when listing big directories, especially in thumbnail mode (we are talking of several hundred of MiB spared). * Generates thumbnails way faster. From code perspective, it: * Is ready for asset engine needs (on data structure level in filebrowser's listing). * Simplifies and makes 'generic' file listing much lighter. * Separates file listing in three different aspects: ** 'generic' filelisting (in BLI), which becomes a shallow wrapper around stat struct. ** 'filebrowser drawing' filelisting, which only contains current visible subset of the whole list (sliding window), with extra drawing data (strings for size, date/time, preview, etc.). ** 'asset-ready' filelisting, which is used for operations common to 'basic' filehandling and future asset-related one. * Uses uuid's to handle file selection/state in the browser, instead of using flags in filelisting items. * Uses much lighter BLI_task handling for previews, instead of heavy 'job' system (using the new 'notifier' timer to handle UI refresh, in similar way to jobs). * Moves .blend datablocks preview handling to IMB_thumbnail (necessary to avoid storing all datablock previews at once, and gives better consistency and performances too). Revision: https://developer.blender.org/D1316 Thanks to Campbell & Sergey for the reviews. :)
This commit is contained in:
@@ -40,22 +40,23 @@ class FILEBROWSER_HT_header(Header):
|
||||
row.operator("file.parent", text="", icon='FILE_PARENT')
|
||||
row.operator("file.refresh", text="", icon='FILE_REFRESH')
|
||||
|
||||
row = layout.row()
|
||||
row.separator()
|
||||
|
||||
row = layout.row(align=True)
|
||||
layout.separator()
|
||||
layout.operator_context = 'EXEC_DEFAULT'
|
||||
row.operator("file.directory_new", icon='NEWFOLDER')
|
||||
layout.operator("file.directory_new", icon='NEWFOLDER', text="")
|
||||
layout.separator()
|
||||
|
||||
layout.operator_context = 'INVOKE_DEFAULT'
|
||||
params = st.params
|
||||
|
||||
# can be None when save/reload with a file selector open
|
||||
if params:
|
||||
is_lib_browser = params.use_library_browsing
|
||||
|
||||
layout.prop(params, "recursion_level", text="")
|
||||
|
||||
layout.prop(params, "display_type", expand=True, text="")
|
||||
|
||||
if params.display_type == 'FILE_IMGDISPLAY':
|
||||
layout.prop(params, "thumbnail_size", text="")
|
||||
layout.prop(params, "thumbnail_size", text="")
|
||||
|
||||
layout.prop(params, "sort_method", expand=True, text="")
|
||||
|
||||
@@ -81,9 +82,17 @@ class FILEBROWSER_HT_header(Header):
|
||||
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')
|
||||
|
||||
layout.template_running_jobs()
|
||||
|
||||
|
||||
class FILEBROWSER_UL_dir(bpy.types.UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
@@ -214,5 +223,24 @@ class FILEBROWSER_PT_recent_folders(Panel):
|
||||
col.operator("file.reset_recent", icon='X', text="")
|
||||
|
||||
|
||||
class FILEBROWSER_PT_advanced_filter(Panel):
|
||||
bl_space_type = 'FILE_BROWSER'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_category = "Filter"
|
||||
bl_label = "Advanced Filter"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
space = context.space_data
|
||||
params = space.params
|
||||
|
||||
if params and params.use_library_browsing:
|
||||
layout.prop(params, "use_filter_blendid")
|
||||
if params.use_filter_blendid:
|
||||
layout.separator()
|
||||
col = layout.column()
|
||||
col.prop(params, "filter_id")
|
||||
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
bpy.utils.register_module(__name__)
|
||||
|
Reference in New Issue
Block a user