diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-05-14 11:21:29 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-05-14 11:21:29 +0400 |
commit | 02b8d3ca0f1763922140a76d8d41e38b089e37fb (patch) | |
tree | 7bcc2c86d2e98dc78619c2f93c65e1d0a2ac0558 /source/blender/editors/space_file/filelist.c | |
parent | 0524fc1df68f8dd56d1ba3fc10d7e5936449544b (diff) |
Disable thumbnail generation when the thumbnail view is not enabled,
was slowing down browsing on NFS.
Diffstat (limited to 'source/blender/editors/space_file/filelist.c')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 66552088085..f545f0e32ff 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -105,6 +105,7 @@ typedef struct ThumbnailJob { short *stop; short *do_update; struct FileList* filelist; + FileSelectParams *params; ReportList reports; } ThumbnailJob; @@ -1278,19 +1279,25 @@ static void thumbnails_startjob(void *tjv, short *stop, short *do_update) tj->do_update= do_update; while ( (*stop==0) && (limg) ) { - if ( limg->flags & IMAGEFILE ) { - limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_IMAGE); - } else if ( limg->flags & MOVIEFILE ) { - limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_MOVIE); - if (!limg->img) { - /* remember that file can't be loaded via IMB_open_anim */ - limg->flags &= ~MOVIEFILE; - limg->flags |= MOVIEFILE_ICON; - } + /* skip if thumbnail view is not enabled, makes network filesystems browse faster */ + if(tj->params->display != FILE_IMGDISPLAY) { + PIL_sleep_ms(100); /* 10th of a sec should be enough */ + } + else { + if ( limg->flags & IMAGEFILE ) { + limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_IMAGE); + } else if ( limg->flags & MOVIEFILE ) { + limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_MOVIE); + if (!limg->img) { + /* remember that file can't be loaded via IMB_open_anim */ + limg->flags &= ~MOVIEFILE; + limg->flags |= MOVIEFILE_ICON; + } + } + *do_update = 1; + PIL_sleep_ms(10); + limg = limg->next; } - *do_update = 1; - PIL_sleep_ms(10); - limg = limg->next; } } @@ -1323,7 +1330,7 @@ static void thumbnails_free(void *tjv) } -void thumbnails_start(struct FileList* filelist, const struct bContext* C) +void thumbnails_start(struct FileList* filelist, FileSelectParams *params, const struct bContext* C) { wmJob *steve; ThumbnailJob *tj; @@ -1332,6 +1339,7 @@ void thumbnails_start(struct FileList* filelist, const struct bContext* C) /* prepare job data */ tj= MEM_callocN(sizeof(ThumbnailJob), "thumbnails\n"); tj->filelist = filelist; + tj->params = params; for (idx = 0; idx < filelist->numfiles;idx++) { if (!filelist->filelist[idx].image) { if ( (filelist->filelist[idx].flags & IMAGEFILE) || (filelist->filelist[idx].flags & MOVIEFILE) ) { |