[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28764] trunk/blender/source/blender/ editors/space_file: == filebrowser ==
Andrea Weikert
elubie at gmx.net
Fri May 14 12:50:43 CEST 2010
Revision: 28764
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28764
Author: elubie
Date: 2010-05-14 12:50:43 +0200 (Fri, 14 May 2010)
Log Message:
-----------
== filebrowser ==
* small update for thumbnails, now the thumbnail thread only runs when the filebrowser is in thumbnail view. (Thread was still running previously, even if it did nothing)
* this allows workaround for slower network drives, so the user can prevent thumbnail generation when not displaying them.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_file/filelist.c
trunk/blender/source/blender/editors/space_file/filelist.h
trunk/blender/source/blender/editors/space_file/space_file.c
Modified: trunk/blender/source/blender/editors/space_file/filelist.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/filelist.c 2010-05-14 10:45:50 UTC (rev 28763)
+++ trunk/blender/source/blender/editors/space_file/filelist.c 2010-05-14 10:50:43 UTC (rev 28764)
@@ -105,7 +105,6 @@
short *stop;
short *do_update;
struct FileList* filelist;
- FileSelectParams *params;
ReportList reports;
} ThumbnailJob;
@@ -1279,25 +1278,19 @@
tj->do_update= do_update;
while ( (*stop==0) && (limg) ) {
- /* 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 */
+ 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;
+ }
}
- 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;
}
}
@@ -1330,7 +1323,7 @@
}
-void thumbnails_start(struct FileList* filelist, FileSelectParams *params, const struct bContext* C)
+void thumbnails_start(struct FileList* filelist, const struct bContext* C)
{
wmJob *steve;
ThumbnailJob *tj;
@@ -1339,7 +1332,6 @@
/* 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) ) {
@@ -1368,3 +1360,8 @@
{
WM_jobs_kill(CTX_wm_manager(C), filelist);
}
+
+int thumbnails_running(struct FileList* filelist, const struct bContext* C)
+{
+ return WM_jobs_test(CTX_wm_manager(C), filelist);
+}
\ No newline at end of file
Modified: trunk/blender/source/blender/editors/space_file/filelist.h
===================================================================
--- trunk/blender/source/blender/editors/space_file/filelist.h 2010-05-14 10:45:50 UTC (rev 28763)
+++ trunk/blender/source/blender/editors/space_file/filelist.h 2010-05-14 10:50:43 UTC (rev 28764)
@@ -85,7 +85,8 @@
int folderlist_clear_next(struct SpaceFile* sfile);
void thumbnails_stop(struct FileList* filelist, const struct bContext* C);
-void thumbnails_start(struct FileList* filelist, FileSelectParams *params, const struct bContext* C);
+void thumbnails_start(struct FileList* filelist, const struct bContext* C);
+int thumbnails_running(struct FileList* filelist, const struct bContext* C);
#ifdef __cplusplus
}
Modified: trunk/blender/source/blender/editors/space_file/space_file.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/space_file.c 2010-05-14 10:45:50 UTC (rev 28763)
+++ trunk/blender/source/blender/editors/space_file/space_file.c 2010-05-14 10:50:43 UTC (rev 28764)
@@ -201,17 +201,28 @@
filelist_sort(sfile->files, params->sort);
}
BLI_strncpy(params->dir, filelist_dir(sfile->files), FILE_MAX);
- thumbnails_start(sfile->files, params, C);
+ if(params->display == FILE_IMGDISPLAY) {
+ thumbnails_start(sfile->files, C);
+ }
} else {
- filelist_filter(sfile->files);
if(params->sort!=FILE_SORT_NONE) {
thumbnails_stop(sfile->files, C);
filelist_sort(sfile->files, params->sort);
- thumbnails_start(sfile->files, params, C);
+ if(params->display == FILE_IMGDISPLAY) {
+ thumbnails_start(sfile->files, C);
+ }
} else {
+ if(params->display == FILE_IMGDISPLAY) {
+ if (!thumbnails_running(sfile->files,C)) {
+ thumbnails_start(sfile->files, C);
+ }
+ } else {
+ /* stop any running thumbnail jobs if we're not
+ displaying them - speedup for NFS */
+ thumbnails_stop(sfile->files, C);
+ }
filelist_filter(sfile->files);
}
-
}
if (params->renamefile[0] != '\0') {
More information about the Bf-blender-cvs
mailing list