[Bf-blender-cvs] [bd9f94e9172] master: Fix T94692: Show Cached OneDrive Thumbnails

Harley Acheson noreply at git.blender.org
Fri Mar 11 19:05:30 CET 2022


Commit: bd9f94e91720e6d2ce5308344e83c5a787351669
Author: Harley Acheson
Date:   Fri Mar 11 10:04:24 2022 -0800
Branches: master
https://developer.blender.org/rBbd9f94e91720e6d2ce5308344e83c5a787351669

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

===================================================================

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

===================================================================

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) {



More information about the Bf-blender-cvs mailing list