[Bf-blender-cvs] [3b440db] master: FileBrowser previews: Get rid of ugly, stupid and confusing 'FILE_TYPE_ICON_MOVIE' hack.

Bastien Montagne noreply at git.blender.org
Wed Apr 8 14:32:32 CEST 2015


Commit: 3b440dbf66afd33ad8ab6f8444a425ca59c6a5c3
Author: Bastien Montagne
Date:   Wed Apr 8 14:29:33 2015 +0200
Branches: master
https://developer.blender.org/rB3b440dbf66afd33ad8ab6f8444a425ca59c6a5c3

FileBrowser previews: Get rid of ugly, stupid and confusing 'FILE_TYPE_ICON_MOVIE' hack.

Was only handling failures in video thumbnails, was confusing (giving two different types
for video files, *sigh*), and... useless, since thumbnail code already handles smartly
failures in preview generation!

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

M	source/blender/editors/space_file/filelist.c
M	source/blender/makesdna/DNA_space_types.h

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

diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 5214b61..d5092ef 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -654,7 +654,7 @@ ImBuf *filelist_geticon(struct FileList *filelist, const int index)
 	if (file->flags & FILE_TYPE_BLENDER) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_BLENDFILE];
 	}
-	else if ((file->flags & FILE_TYPE_MOVIE) || (file->flags & FILE_TYPE_MOVIE_ICON)) {
+	else if (file->flags & FILE_TYPE_MOVIE) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_MOVIEFILE];
 	}
 	else if (file->flags & FILE_TYPE_SOUND) {
@@ -1334,23 +1334,23 @@ static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float
 	tj->do_update = do_update;
 
 	while ((*stop == 0) && (limg)) {
+		ThumbSource source = 0;
+
+		BLI_assert(limg->flags & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE | FILE_TYPE_FTFONT |
+		                          FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP));
 		if (limg->flags & FILE_TYPE_IMAGE) {
-			limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_IMAGE);
+			source = 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);
+			source = 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;
-			}
+			source = THB_SOURCE_MOVIE;
 		}
 		else if (limg->flags & FILE_TYPE_FTFONT) {
-			limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_FONT);
+			source = THB_SOURCE_FONT;
 		}
+		limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, source);
 		*do_update = true;
 		PIL_sleep_ms(10);
 		limg = limg->next;
@@ -1366,11 +1366,6 @@ 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 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;
-				}
 				limg->done = true;
 				IMB_freeImBuf(limg->img);
 				limg->img = NULL;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index c2f49ea..29b78c1 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -712,7 +712,7 @@ typedef enum eFileSel_File_Types {
 	FILE_TYPE_FTFONT            = (1 << 7),
 	FILE_TYPE_SOUND             = (1 << 8),
 	FILE_TYPE_TEXT              = (1 << 9),
-	FILE_TYPE_MOVIE_ICON        = (1 << 10), /* movie file that preview can't load */
+	/* 1 << 10 was FILE_TYPE_MOVIE_ICON, got rid of this so free slot for future type... */
 	FILE_TYPE_FOLDER            = (1 << 11), /* represents folders for filtering */
 	FILE_TYPE_BTX               = (1 << 12),
 	FILE_TYPE_COLLADA           = (1 << 13),




More information about the Bf-blender-cvs mailing list