From 8c539b0ab521d442d88c70243c04cbb9e40fe412 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 Apr 2015 10:10:17 +1000 Subject: Font preview for file browser D1002 by @plasmasolutions, with own refactoring. Note, needed to do a bad-level call here (IMB -> BLF) Also can't use the BLF API directly because its not thread-safe. So keep the function isolated (blf_thumbs.c). --- source/blender/editors/space_file/filelist.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_file/filelist.c') diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 66acd7d05e3..5214b611fb9 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1348,6 +1348,9 @@ static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float limg->flags |= FILE_TYPE_MOVIE_ICON; } } + else if (limg->flags & FILE_TYPE_FTFONT) { + limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_FONT); + } *do_update = true; PIL_sleep_ms(10); limg = limg->next; @@ -1363,7 +1366,7 @@ static void thumbnails_update(void *tjv) while (limg) { if (!limg->done && limg->img) { tj->filelist->filelist[limg->index].image = IMB_dupImBuf(limg->img); - /* update flag for movie files where thumbnail can't be created */ + /* update flag for movie and font files where thumbnail can't be created */ if (limg->flags & FILE_TYPE_MOVIE_ICON) { tj->filelist->filelist[limg->index].flags &= ~FILE_TYPE_MOVIE; tj->filelist->filelist[limg->index].flags |= FILE_TYPE_MOVIE_ICON; @@ -1408,7 +1411,7 @@ void thumbnails_start(FileList *filelist, const bContext *C) continue; } if (!filelist->filelist[idx].image) { - if (filelist->filelist[idx].flags & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE | + if (filelist->filelist[idx].flags & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE | FILE_TYPE_FTFONT | FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) { FileImage *limg = MEM_callocN(sizeof(*limg), __func__); -- cgit v1.2.3