[Bf-blender-cvs] [a592525] asset-experiments: FileBrowser: cleanup (remove) all the thumbnails job stuff, no more needed.

Bastien Montagne noreply at git.blender.org
Thu Apr 2 13:53:51 CEST 2015


Commit: a592525a7e9c573373d67feb9f5e8d9f53cdcc76
Author: Bastien Montagne
Date:   Thu Apr 2 10:38:19 2015 +0200
Branches: asset-experiments
https://developer.blender.org/rBa592525a7e9c573373d67feb9f5e8d9f53cdcc76

FileBrowser: cleanup (remove) all the thumbnails job stuff, no more needed.

===================================================================

M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_file/filelist.h
M	source/blender/editors/space_file/filesel.c
M	source/blender/windowmanager/WM_api.h

===================================================================

diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index e13f02d..54d275b 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -2482,156 +2482,3 @@ int filelist_readjob_running(wmWindowManager *wm, FileList *filelist)
 {
 	return WM_jobs_test(wm, filelist, WM_JOB_TYPE_FILESEL_READDIR);
 }
-
-/* ********** Thumbnails job ********** */
-
-typedef struct FileImage {
-	struct FileImage *next, *prev;
-	char path[FILE_MAX];
-	unsigned int flags;
-	int index;
-	short done;
-	ImBuf *img;
-} FileImage;
-
-typedef struct ThumbnailJob {
-	ListBase loadimages;
-	const short *stop;
-	const short *do_update;
-	struct FileList *filelist;
-	ReportList reports;
-} ThumbnailJob;
-
-bool filelist_need_thumbnails(FileList *filelist)
-{
-	return false;
-}
-
-static void thumbnail_joblist_free(ThumbnailJob *tj)
-{
-	FileImage *limg = tj->loadimages.first;
-	
-	/* free the images not yet copied to the filelist -> these will get freed with the filelist */
-	for (; limg; limg = limg->next) {
-		if ((limg->img) && (!limg->done)) {
-			IMB_freeImBuf(limg->img);
-		}
-	}
-	BLI_freelistN(&tj->loadimages);
-}
-
-static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float *UNUSED(progress))
-{
-	ThumbnailJob *tj = tjv;
-	FileImage *limg = tj->loadimages.first;
-
-	tj->stop = stop;
-	tj->do_update = do_update;
-
-	while ((*stop == 0) && (limg)) {
-		if (limg->flags & FILE_TYPE_IMAGE) {
-			limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_IMAGE);
-		}
-		else if (limg->flags & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) {
-			limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_BLEND);
-		}
-		else if (limg->flags & FILE_TYPE_MOVIE) {
-			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 &= ~FILE_TYPE_MOVIE;
-				limg->flags |= FILE_TYPE_MOVIE_ICON;
-			}
-		}
-		*do_update = true;
-		limg = limg->next;
-	}
-}
-
-static void thumbnails_update(void *tjv)
-{
-	ThumbnailJob *tj = tjv;
-
-	if (tj->filelist) {
-		FileImage *limg = tj->loadimages.first;
-		while (limg) {
-			if (!limg->done && limg->img) {
-				/* entry might have been removed from cache in the mean while, we do not want to cache it again here. */
-				FileDirEntry *entry = filelist_file_ex(tj->filelist, limg->index, false);
-				if (entry) {
-					entry->image = IMB_dupImBuf(limg->img);
-					/* update flag for movie files where thumbnail can't be created */
-					if (limg->flags & FILE_TYPE_MOVIE_ICON) {
-						entry->typeflag &= ~FILE_TYPE_MOVIE;
-						entry->typeflag |= FILE_TYPE_MOVIE_ICON;
-					}
-				}
-				limg->done = true;
-				IMB_freeImBuf(limg->img);
-				limg->img = NULL;
-			}
-			limg = limg->next;
-		}
-	}
-}
-
-static void thumbnails_endjob(void *tjv)
-{
-	ThumbnailJob *tj = tjv;
-}
-
-static void thumbnails_free(void *tjv)
-{
-	ThumbnailJob *tj = tjv;
-	thumbnail_joblist_free(tj);
-	MEM_freeN(tj);
-}
-
-
-void thumbnails_start(FileList *filelist, const bContext *C)
-{
-	wmJob *wm_job;
-	ThumbnailJob *tj;
-	FileDirEntry *entry;
-	void *iter = filelist_file_cache_iter_start(filelist);
-	int idx;
-
-	/* prepare job data */
-	tj = MEM_callocN(sizeof(*tj), __func__);
-	tj->filelist = filelist;
-	while ((entry = filelist_file_cache_iter_next(iter, &idx))) {
-		if (!entry->image) {
-			if (entry->typeflag & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE | FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) {
-				FileImage *limg = MEM_callocN(sizeof(*limg), __func__);
-				BLI_join_dirfile(limg->path, sizeof(limg->path), filelist->filelist.root, entry->relpath);
-				limg->index = idx;
-				limg->flags = entry->typeflag;
-				BLI_addtail(&tj->loadimages, limg);
-			}
-		}
-	}
-
-	filelist_file_cache_iter_end(iter);
-
-	BKE_reports_init(&tj->reports, RPT_PRINT);
-
-	/* setup job */
-	wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), filelist, "Thumbnails",
-	                     0, WM_JOB_TYPE_FILESEL_THUMBNAIL);
-	WM_jobs_customdata_set(wm_job, tj, thumbnails_free);
-	WM_jobs_timer(wm_job, 0.5, NC_WINDOW, NC_WINDOW);
-	WM_jobs_callbacks(wm_job, thumbnails_startjob, NULL, thumbnails_update, thumbnails_endjob);
-
-	/* start the job */
-	WM_jobs_start(CTX_wm_manager(C), wm_job);
-}
-
-void thumbnails_stop(wmWindowManager *wm, FileList *filelist)
-{
-	WM_jobs_kill_type(wm, filelist, WM_JOB_TYPE_FILESEL_THUMBNAIL);
-}
-
-int thumbnails_running(wmWindowManager *wm, FileList *filelist)
-{
-	return WM_jobs_test(wm, filelist, WM_JOB_TYPE_FILESEL_THUMBNAIL);
-}
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h
index 7fcfa05..64a1765 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -117,11 +117,6 @@ int                 filelist_readjob_running(struct wmWindowManager *wm, struct
 bool                filelist_cache_previews_update(struct FileList *filelist);
 void                filelist_cache_previews_set(struct FileList *filelist, const bool use_previews);
 
-bool                filelist_need_thumbnails(struct FileList *filelist);
-void                thumbnails_start(struct FileList *filelist, const struct bContext *C);
-void                thumbnails_stop(struct wmWindowManager *wm, struct FileList *filelist);
-int                 thumbnails_running(struct wmWindowManager *wm, struct FileList *filelist);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 446990b..b6256f5 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -753,7 +753,6 @@ void ED_fileselect_clear(struct wmWindowManager *wm, struct SpaceFile *sfile)
 	/* only NULL in rare cases - [#29734] */
 	if (sfile->files) {
 		filelist_readjob_stop(wm, sfile->files);
-		thumbnails_stop(wm, sfile->files);
 		filelist_freelib(sfile->files);
 		filelist_clear(sfile->files);
 	}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 6624a40..938e052 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -391,7 +391,6 @@ enum {
 	WM_JOB_TYPE_OBJECT_SIM_FLUID,
 	WM_JOB_TYPE_OBJECT_BAKE_TEXTURE,
 	WM_JOB_TYPE_OBJECT_BAKE,
-	WM_JOB_TYPE_FILESEL_THUMBNAIL,
 	WM_JOB_TYPE_FILESEL_READDIR,
 	WM_JOB_TYPE_CLIP_BUILD_PROXY,
 	WM_JOB_TYPE_CLIP_TRACK_MARKERS,




More information about the Bf-blender-cvs mailing list