diff --git a/source/blender/editors/space_file/filelist.cc b/source/blender/editors/space_file/filelist.cc index e551f4cecb7..fc730bbee99 100644 --- a/source/blender/editors/space_file/filelist.cc +++ b/source/blender/editors/space_file/filelist.cc @@ -183,7 +183,6 @@ struct FileListEntryPreview { char filepath[FILE_MAX_LIBEXTRA]; uint flags; int index; - int attributes; /* from FileDirEntry. */ int icon_id; }; @@ -1534,10 +1533,8 @@ static void filelist_cache_preview_runf(TaskPool *__restrict pool, void *taskdat IMB_thumb_path_lock(preview->filepath); /* Always generate biggest preview size for now, it's simpler and avoids having to re-generate - * in case user switch to a bigger preview size. Do not create preview when file is offline. */ - ImBuf *imbuf = (preview->attributes & FILE_ATTR_OFFLINE) ? - IMB_thumb_read(preview->filepath, THB_LARGE) : - IMB_thumb_manage(preview->filepath, THB_LARGE, source); + * in case user switch to a bigger preview size. */ + ImBuf *imbuf = IMB_thumb_manage(preview->filepath, THB_LARGE, source); IMB_thumb_path_unlock(preview->filepath); if (imbuf) { preview->icon_id = BKE_icon_imbuf_create(imbuf); @@ -1667,7 +1664,6 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry FileListEntryPreview *preview = MEM_new(__func__); preview->index = index; preview->flags = entry->typeflag; - preview->attributes = entry->attributes; preview->icon_id = 0; if (preview_in_memory) { diff --git a/source/blender/imbuf/IMB_thumbs.h b/source/blender/imbuf/IMB_thumbs.h index 9506546e3b8..0d5cd0e21de 100644 --- a/source/blender/imbuf/IMB_thumbs.h +++ b/source/blender/imbuf/IMB_thumbs.h @@ -74,6 +74,9 @@ void IMB_thumb_delete(const char *file_or_lib_path, ThumbSize size); /** * Create the thumb if necessary and manage failed and old thumbs. + * Will not attempt to (re)create thumbnails of offline files. In this case only a preexisting + * thumbnail is returned, or null if none was found. + * * \param file_or_lib_path: File path or library-ID path (e.g. `/a/b.blend/Material/MyMaterial`) to * the thumbnail to be created/managed. */ diff --git a/source/blender/imbuf/intern/thumbs.cc b/source/blender/imbuf/intern/thumbs.cc index da9fc72f6b5..80714d6fdc1 100644 --- a/source/blender/imbuf/intern/thumbs.cc +++ b/source/blender/imbuf/intern/thumbs.cc @@ -557,6 +557,17 @@ ImBuf *IMB_thumb_manage(const char *file_or_lib_path, ThumbSize size, ThumbSourc if (!uri_from_filename(file_or_lib_path, uri)) { return nullptr; } + + /* Don't access offline files, only use already existing thumbnails (don't recreate). */ + const eFileAttributes file_attributes = BLI_file_attributes(file_path); + if (file_attributes & FILE_ATTR_OFFLINE) { + char thumb_path[FILE_MAX]; + if (thumbpath_from_uri(uri, thumb_path, sizeof(thumb_path), size)) { + return IMB_loadiffname(thumb_path, IB_rect | IB_metadata, nullptr); + } + return nullptr; + } + char thumb_path[FILE_MAX]; if (thumbpath_from_uri(uri, thumb_path, sizeof(thumb_path), THB_FAIL)) { /* failure thumb exists, don't try recreating */