[Bf-blender-cvs] [0bdf85a] asset-experiments: FileBrowser: make (fixed) column size user-configurable (re[ab]using new thumbnail size).
Bastien Montagne
noreply at git.blender.org
Mon May 4 17:01:26 CEST 2015
Commit: 0bdf85afde2bf4517827f0e2a8588b1cde75be1c
Author: Bastien Montagne
Date: Mon May 4 16:15:12 2015 +0200
Branches: asset-experiments
https://developer.blender.org/rB0bdf85afde2bf4517827f0e2a8588b1cde75be1c
FileBrowser: make (fixed) column size user-configurable (re[ab]using new thumbnail size).
===================================================================
M release/scripts/startup/bl_ui/space_filebrowser.py
M source/blender/editors/space_file/filesel.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 9033ff9..2d7f1f1 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -56,8 +56,7 @@ class FILEBROWSER_HT_header(Header):
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="")
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index a7a6c03..a2bf5bc 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -482,7 +482,7 @@ float file_font_pointsize(void)
#endif
}
-static void column_widths(struct FileList *UNUSED(files), struct FileLayout *layout)
+static void column_widths(FileSelectParams *params, struct FileLayout *layout)
{
int i;
@@ -490,9 +490,8 @@ static void column_widths(struct FileList *UNUSED(files), struct FileLayout *lay
layout->column_widths[i] = 0;
}
- /* Biggest possible reasonable values...
- * TODO: better ways to get those! */
- layout->column_widths[COLUMN_NAME] = file_string_width("WMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM");
+ layout->column_widths[COLUMN_NAME] = ((float)params->thumbnail_size / 8.0f) * UI_UNIT_X;;
+ /* Biggest possible reasonable values... */
layout->column_widths[COLUMN_DATE] = file_string_width("23-Dec-89");
layout->column_widths[COLUMN_TIME] = file_string_width("23:59");
layout->column_widths[COLUMN_SIZE] = file_string_width("987.64 MiB");
@@ -554,7 +553,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
layout->height = (int)(BLI_rctf_size_y(&v2d->cur) - 2 * layout->tile_border_y);
layout->rows = layout->height / (layout->tile_h + 2 * layout->tile_border_y);
- column_widths(sfile->files, layout);
+ column_widths(params, layout);
if (params->display == FILE_SHORTDISPLAY) {
maxlen = ICON_DEFAULT_WIDTH_SCALE + column_icon_space +
More information about the Bf-blender-cvs
mailing list