Thumbnails: Always use cached thumbnails for offline files #112101
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#112101
Loading…
Reference in New Issue
No description provided.
Delete Branch "JulianEisel/blender:temp-offline-file-thumbnail"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
bd9f94e917
made it so the file browser doesn't bring files online forthe purpuse of creating their thumbnail, because that can take a while.
Instead it uses a previously cached thumbnail if available. This should
be the behavior for all cases thumbnails are requested, it's not only
the file browser that does this.
In fact it makes sense to move this into the normal function to "manage"
thumbnails (that is, load and if necessary (re)create cached
thumbnails) since there are no currently known use-cases for
different behavior.
Also, seems like the previous solution didn't work when loading ID
previews from offline .blend files. For that we need to use the path to
the .blend file to check the offline status, not the full path to the ID.
Found while working on #109234 (Use UI preview system for async loading of
file/asset previews).
Thumbnails: Use cached thumbnails for offline files, don't access fileto Thumbnails: Always use cached thumbnails for offline filesWorks great. I tested this with files in "One Drive". Works correctly when offline and online, with existing thumbnails and without.
Fairly certain I had only added attributes to that FileListEntryPreview so that they would be cached, but I like this idea better.
However, this PR has the attribute check fairly early in
IMB_thumb_manage
, even before checking for the failed ones. Fairly certain we get the same effect but more simply if we check the attributes inthumb_create_or_fail
where it can just return nullptr. Unless I need more coffee, I think that gets us what we want: return the already-created thumbnail if we have it, return nullptr if a failed one, create a new one only if not offline. At least it tests out okay:Wait, no...
There is probably an edge case with mine. If the file is newer than its thumbnail, but now offline, your version should still return the last thumbnail. My version will return a generic icon.
This would do everything, fairly sure. Loads a thumbnail if it already exists, but then does not create or recreate if offline:
Makes sense to respect failed thumbnails. Only issue is that failed thumbnail handling deletes out-of-date failed thumbnails, I don't think we should do that for offline ones, because we can't recreate them.
Also I'd prefer to not mix special-cases like this with the main function logic. For example in your snippet it can easily happen that a new branch is added on the level of the
if (BLI_path_ncmp())
branch, and in there the offline file case is forgotten. Generally I'd consider it good practice to separate edge case handling from normal logic (which is often more complicated). Do the former first, so the latter doesn't have to deal with it -- this is more future proof.Make sense. It was nice to look at this code again.