diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2022-03-11 21:04:24 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2022-03-11 21:05:16 +0300 |
commit | bd9f94e91720e6d2ce5308344e83c5a787351669 (patch) | |
tree | e4717178d8ba28d2c98d3736292afb76a059835d /source/blender/editors/space_file | |
parent | 22807d2075b0bcc7b5ae655ba43b08a4e44b002b (diff) |
Fix T94692: Show Cached OneDrive Thumbnails
When OneDrive files are offline, show preexisting thumbnails.
See D13930 for details.
Differential Revision: https://developer.blender.org/D13930
Reviewed by Julian Eisel
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index d47e67b9d27..363e19a8905 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -339,7 +339,7 @@ typedef struct FileListEntryPreview { char path[FILE_MAX]; uint flags; int index; - + int attributes; /* from FileDirEntry. */ int icon_id; } FileListEntryPreview; @@ -1623,8 +1623,10 @@ static void filelist_cache_preview_runf(TaskPool *__restrict pool, void *taskdat IMB_thumb_path_lock(preview->path); /* 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. */ - ImBuf *imbuf = IMB_thumb_manage(preview->path, THB_LARGE, source); + * 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->path, THB_LARGE) : + IMB_thumb_manage(preview->path, THB_LARGE, source); IMB_thumb_path_unlock(preview->path); if (imbuf) { preview->icon_id = BKE_icon_imbuf_create(imbuf); @@ -1704,11 +1706,6 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry BLI_assert(cache->flags & FLC_PREVIEWS_ACTIVE); - if (!entry->preview_icon_id && (entry->attributes & FILE_ATTR_OFFLINE)) { - entry->flags |= FILE_ENTRY_INVALID_PREVIEW; - return; - } - if (entry->preview_icon_id) { return; } @@ -1735,6 +1732,7 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry FileListEntryPreview *preview = MEM_mallocN(sizeof(*preview), __func__); preview->index = index; preview->flags = entry->typeflag; + preview->attributes = entry->attributes; preview->icon_id = 0; if (preview_in_memory) { |