FileBrowser previews: Get rid of ugly, stupid and confusing 'FILE_TYPE_ICON_MOVIE...
authorBastien Montagne <montagne29@wanadoo.fr>
Wed, 8 Apr 2015 12:29:33 +0000 (14:29 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Wed, 8 Apr 2015 12:31:49 +0000 (14:31 +0200)
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!

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

index 5214b611fb979fba525a55ccf9e2a57901e84739..d5092ef46d7c7be8d809f0ff8895dbcfee140f24 100644 (file)
@@ -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;
index c2f49ea92b58372af173c4fcddd7f2082c30e34e..29b78c158fd4e1a098eab2c72631bc6c7915770b 100644 (file)
@@ -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),