[#22133] File Browser Mismatches File Name and Thumbnail
authorAndrea Weikert <elubie@gmx.net>
Thu, 29 Apr 2010 18:53:01 +0000 (18:53 +0000)
committerAndrea Weikert <elubie@gmx.net>
Thu, 29 Apr 2010 18:53:01 +0000 (18:53 +0000)
* sorting of file list interfered with thumbnail order, stopping job while sorting now.

source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/space_file.c

index 455a5ab951e65e9f5ee7bb8354f5105f5fe31e7e..f38b06e7b859181d698e57fad151a43929d732a8 100644 (file)
@@ -613,9 +613,7 @@ struct ImBuf * filelist_loadimage(struct FileList* filelist, int index)
        if (!imb)
        {
                if ( (filelist->filelist[fidx].flags & IMAGEFILE) || (filelist->filelist[fidx].flags & MOVIEFILE) ) {
-                       char path[FILE_MAX];
-                       BLI_join_dirfile(path, filelist->dir, filelist->filelist[fidx].relname);
-                       imb = IMB_thumb_read(path, THB_NORMAL);
+                       imb = IMB_thumb_read(filelist->filelist[fidx].path, THB_NORMAL);
                } 
                if (imb) {
                        filelist->filelist[fidx].image = imb;
@@ -1336,7 +1334,7 @@ void thumbnails_start(struct FileList* filelist, const struct bContext* C)
                if (!filelist->filelist[idx].image) {
                        if ( (filelist->filelist[idx].flags & IMAGEFILE) || (filelist->filelist[idx].flags & MOVIEFILE) ) {
                                FileImage* limg = MEM_callocN(sizeof(struct FileImage), "loadimage");
-                               BLI_join_dirfile(limg->path, filelist->dir, filelist->filelist[idx].relname);
+                               BLI_strncpy(limg->path, filelist->filelist[idx].path, FILE_MAX);
                                limg->index= idx;
                                limg->flags= filelist->filelist[idx].flags;
                                BLI_addtail(&tj->loadimages, limg);
index 4edc3268fcbb68f65c66f676e98fd79245a2ae70..efdd8cb0db10e8afbe11340e61c90f298fc23f8e 100644 (file)
@@ -195,13 +195,24 @@ static void file_refresh(const bContext *C, ScrArea *sa)
        filelist_setfilter(sfile->files, params->flag & FILE_FILTER ? params->filter : 0);      
        if (filelist_empty(sfile->files))
        {
+               thumbnails_stop(sfile->files, C);
                filelist_readdir(sfile->files);
-               thumbnails_start(sfile->files, C);
+               if(params->sort!=FILE_SORT_NONE) {
+                       filelist_sort(sfile->files, params->sort);
+               }
                BLI_strncpy(params->dir, filelist_dir(sfile->files), FILE_MAX);
+               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, C);
+               } else {
+                       filelist_filter(sfile->files);
+               }
+
        }
-       if(params->sort!=FILE_SORT_NONE) filelist_sort(sfile->files, params->sort);             
        
        if (params->renamefile[0] != '\0') {
                int idx = filelist_find(sfile->files, params->renamefile);