Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_file/filelist.c')
-rw-r--r--source/blender/editors/space_file/filelist.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 66acd7d05e3..4048c9fc1a1 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) {
@@ -900,7 +900,6 @@ static void filelist_setfiletypes(struct FileList *filelist)
file = filelist->filelist;
for (num = 0; num < filelist->numfiles; num++, file++) {
- file->type = file->s.st_mode; /* restore the mess below */
#ifndef __APPLE__
/* Don't check extensions for directories, allow in OSX cause bundles have extensions*/
if (file->type & S_IFDIR) {
@@ -1105,7 +1104,7 @@ static void filelist_from_library(struct FileList *filelist)
previews = NULL;
nprevs = 0;
names = BLO_blendhandle_get_linkable_groups(filelist->libfiledata);
- nnames = BLI_linklist_length(names);
+ nnames = BLI_linklist_count(names);
}
filelist->numfiles = nnames + 1;
@@ -1235,7 +1234,7 @@ static void filelist_from_main(struct FileList *filelist)
files = filelist->filelist;
- if (!filelist->filter_data.hide_parent) {
+ if (files && !filelist->filter_data.hide_parent) {
memset(&(filelist->filelist[0]), 0, sizeof(struct direntry));
filelist->filelist[0].relname = BLI_strdup(FILENAME_PARENT);
filelist->filelist[0].type |= S_IFDIR;
@@ -1247,7 +1246,7 @@ static void filelist_from_main(struct FileList *filelist)
for (id = lb->first; id; id = id->next) {
ok = 1;
if (ok) {
- if (!filelist->filter_data.hide_dot || id->name[2] != '.') {
+ if (files && (!filelist->filter_data.hide_dot || id->name[2] != '.')) {
memset(files, 0, sizeof(struct direntry));
if (id->lib == NULL) {
files->relname = BLI_strdup(id->name + 2);
@@ -1334,20 +1333,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) {
+ source = THB_SOURCE_FONT;
+ }
+ limg->img = IMB_thumb_manage(limg->path, THB_LARGE, source);
*do_update = true;
PIL_sleep_ms(10);
limg = limg->next;
@@ -1363,11 +1365,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 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;
@@ -1408,7 +1405,7 @@ void thumbnails_start(FileList *filelist, const bContext *C)
continue;
}
if (!filelist->filelist[idx].image) {
- if (filelist->filelist[idx].flags & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE |
+ if (filelist->filelist[idx].flags & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE | FILE_TYPE_FTFONT |
FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP))
{
FileImage *limg = MEM_callocN(sizeof(*limg), __func__);