Imbuf: Change thumbnail caching location #107298

Open
Ankit Meel wants to merge 1 commits from ankitm/blender:ankitm/thumbn into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

New paths are in decreasing order of priority.

Windows
Old: %CSIDL_PROFILE%.thumbnails
New: note the removal of leading period
%USERPROFILE%\AppData\Local\Blender Foundation\Blender\Cache\thumbnails
BKE_tempdir_base\Blender Foundation\Blender\Cache\thumbnails

Linux
Old: $XDG_CACHE_HOME/thumbnails or $HOME/.cache/thumbnails
New:
$XDG_CACHE_HOME/thumbnails
$HOME/.cache/blender/thumbnails
BKE_tempdir_base/blender/thumbnails/

macOS
Old: $HOME/.thumbnails
New: note the removal of leading period: makes the folder user visible
~/Library/Cache/Blender/thumbnails
BKE_tempdir_base/Blender/thumbnails

BKE_appdir_folder_caches added recently replaces the manual cache
folder finding done here.
Simplify char array handling also.


It was previously at https://archive.blender.org/developer/differential/0013/0013214/index.html
This time undefined thumbnail also and put it in BLI_path_join call.
Also the return len < dir_len has been added

New paths are in decreasing order of priority. Windows Old: %CSIDL_PROFILE%\.thumbnails New: note the removal of leading period %USERPROFILE%\AppData\Local\Blender Foundation\Blender\Cache\thumbnails BKE_tempdir_base\Blender Foundation\Blender\Cache\thumbnails Linux Old: $XDG_CACHE_HOME/thumbnails or $HOME/.cache/thumbnails New: $XDG_CACHE_HOME/thumbnails $HOME/.cache/blender/thumbnails BKE_tempdir_base/blender/thumbnails/ macOS Old: $HOME/.thumbnails New: note the removal of leading period: makes the folder user visible ~/Library/Cache/Blender/thumbnails BKE_tempdir_base/Blender/thumbnails BKE_appdir_folder_caches added recently replaces the manual cache folder finding done here. Simplify char array handling also. ----------- It was previously at https://archive.blender.org/developer/differential/0013/0013214/index.html This time undefined thumbnail also and put it in BLI_path_join call. Also the return len < dir_len has been added
Ankit Meel added 1 commit 2023-04-24 14:45:17 +02:00
Imbuf: Change thumbnail caching location
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
68b540f531
New paths are in decreasing order of priority.

Windows
Old: %CSIDL_PROFILE%\.thumbnails
New: note the removal of leading period
%USERPROFILE%\AppData\Local\Blender Foundation\Blender\Cache\thumbnails
BKE_tempdir_base\Blender Foundation\Blender\Cache\thumbnails

Linux
Old: $XDG_CACHE_HOME/thumbnails or $HOME/.cache/thumbnails
New:
$XDG_CACHE_HOME/thumbnails
$HOME/.cache/blender/thumbnails
BKE_tempdir_base/blender/thumbnails/

macOS
Old: $HOME/.thumbnails
New: note the removal of leading period: makes the folder user visible
~/Library/Cache/Blender/thumbnails
BKE_tempdir_base/Blender/thumbnails

BKE_appdir_folder_caches added recently replaces the manual cache
folder finding done here.
Simplify char array handling also.

-----------

It was previously at https://archive.blender.org/developer/differential/0013/0013214/index.html
This time undefined thumbnail also and put it in BLI_path_join call.
Author
Member

@blender-bot build

@blender-bot build
Ankit Meel requested review from Brecht Van Lommel 2023-04-24 14:58:36 +02:00
Ankit Meel requested review from Campbell Barton 2023-04-24 14:58:36 +02:00
Ankit Meel requested review from Harley Acheson 2023-04-24 14:58:37 +02:00
Ankit Meel requested review from Ray molenkamp 2023-04-24 14:58:37 +02:00
Member

I do like the idea of moving us away from using the standard we are currently using. By no longer sharing these folders with other apps we are freed to use it in new ways.

We could decide to one day save the previews as EXR instead of PNG, so they are both smaller and faster to read and write. Or save our previews in a size that is larger than that supported by the standard: 512x512 for example.

It might be nice to (possibly) support more than one location at a time. So a shared network location might also contain a read-only cache of previews. It might also be nice to make this location overridable via command-line argument and/or environment variable.

We could support file arguments to provide multiple preview types. So a preview of "this.ttf" would give the regular preview, while a preview of "this.ttf?format=2" could be a horizontal string that we could use in lists.

We could support multiple preview types at once. We could show a PNG thumbnail of a video in the File Browser list but then show a tiny low-res video file in the tooltip.

We could support textual previews of some things. For example many users have complained that while directory listings are instant, browsing inside blends can take forever on slow connections. But we could cache a listing of the blend contents to speed that up.

I do like the idea of moving us away from using the standard we are currently using. By no longer sharing these folders with other apps we are freed to use it in new ways. We could decide to one day save the previews as EXR instead of PNG, so they are both smaller and faster to read and write. Or save our previews in a size that is larger than that supported by the standard: 512x512 for example. It might be nice to (possibly) support more than one location at a time. So a shared network location might also contain a read-only cache of previews. It might also be nice to make this location overridable via command-line argument and/or environment variable. We could support file arguments to provide multiple preview types. So a preview of "this.ttf" would give the regular preview, while a preview of "this.ttf?format=2" could be a horizontal string that we could use in lists. We could support multiple preview types at once. We could show a PNG thumbnail of a video in the File Browser list but then show a tiny low-res video file in the tooltip. We could support textual previews of some things. For example many users have complained that while directory listings are instant, browsing inside blends can take forever on slow connections. But we could cache a listing of the blend contents to speed that up.
Member

There is no motivation for this outlined here, so I don't quite understand where this is coming from. On Linux and macOS these locations are standardized, so why would we want to deviate? (Although I think on macOS we use a non-standard location now and this patch corrects that?) On Linux the file browser system thumbnails would stop working I guess. I bet there are tools to cleanup such temporary data, and they wouldn't work with Blender thumbnails anymore.

There is no motivation for this outlined here, so I don't quite understand where this is coming from. On Linux and macOS these locations are standardized, so why would we want to deviate? (Although I think on macOS we use a non-standard location now and this patch corrects that?) On Linux the file browser system thumbnails would stop working I guess. I bet there are tools to cleanup such temporary data, and they wouldn't work with Blender thumbnails anymore.
Author
Member

On win, Ray and Harley approved the location change. Plus I don't think any other system is dependent on the location of blender thumbnail cache. Plus the original comment " /* Yes, applications shouldn't store data there, but so does GIMP :). */"

For mac, ccache recently moved from ~/.cache to ~/Library/Caches/ccache. I frequently delete ~/Library/Caches folder if it gets big. Apple has an API for getting the path https://developer.apple.com/documentation/foundation/nssearchpathdirectory/nscachesdirectory

So the patch simplifies code and improves app behaviour for these two platforms.

On Linux the file browser system thumbnails would stop working I guess

For linux, I was not aware of this and indeed it's a major downgrade. Would it be fine if I keep the behaviour on linux same and still make code changes ?

On win, Ray and Harley approved the location change. Plus I don't think any other system is dependent on the location of blender thumbnail cache. Plus the original comment " /* Yes, applications shouldn't store data there, but so does GIMP :). */" For mac, ccache recently moved from ~/.cache to ~/Library/Caches/ccache. I frequently delete ~/Library/Caches folder if it gets big. Apple has an API for getting the path https://developer.apple.com/documentation/foundation/nssearchpathdirectory/nscachesdirectory So the patch simplifies code and improves app behaviour for these two platforms. >On Linux the file browser system thumbnails would stop working I guess For linux, I was not aware of this and indeed it's a major downgrade. Would it be fine if I keep the behaviour on linux same and still make code changes ?
Member

Just please make sure that your PRs always include a motivation, this is arguably the most important part of the description (also see https://wiki.blender.org/wiki/Process/Contributing_Code#Ingredients_of_a_Pull_Request)

  • Windows: No idea if there is a standard thumbnail/cache location, if the path you chose makes more sense, go for it of course.
  • macOS: Right if this is the standard location now, let's use it. But shouldn't we actually query NSCachesDirectory then?
  • Linux: Sure if the code becomes easier but the behavior doesn't change, that's fine.
Just please make sure that your PRs always include a motivation, this is arguably the most important part of the description (also see https://wiki.blender.org/wiki/Process/Contributing_Code#Ingredients_of_a_Pull_Request) * Windows: No idea if there is a standard thumbnail/cache location, if the path you chose makes more sense, go for it of course. * macOS: Right if this is the standard location now, let's use it. But shouldn't we actually query `NSCachesDirectory` then? * Linux: Sure if the code becomes easier but the behavior doesn't change, that's fine.
Member
  • macOS: Right if this is the standard location now, let's use it. But shouldn't we actually query NSCachesDirectory then?

Ah never mind, I see this patch does that in fact.

> * macOS: Right if this is the standard location now, let's use it. But shouldn't we actually query `NSCachesDirectory` then? Ah never mind, I see this patch does that in fact.
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
This pull request has changes conflicting with the target branch.
  • source/blender/imbuf/intern/thumbs.c

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u ankitm/thumbn:ankitm-ankitm/thumbn
git checkout ankitm-ankitm/thumbn
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107298
No description provided.