UI: Dynamic File Browser Tooltips #104547

Merged
Harley Acheson merged 27 commits from Harley/blender:FileTooltips into main 2024-01-03 03:56:23 +01:00
Member

Show tooltips in File Browser (both in thumbnail and list views) that
provide extra information and vary by type, like video resolution and
frames, etc.


I've proposed something similar a few years ago but this approach is radically different. File Browser no longer needs any knowledge about how to examine these files or create thumbnails. Information passed around only using thumbnail metadata for images and videos.

The thumbnail creation and storage method we use is a standard that includes storing textual data as well. And we currently do this for image dimensions - we just don't currently do anything with this information. This patch extends this process a bit further, storing details about images and videos in each preview's metadata.

Following shows hovering over an image and seeing dimensions:

image

Showing the version of Blender that saved this blend file. Note that it shows the full name, while it is truncated in the list.

image

Following shows seeing video details in a situation that wouldn't allow us to do it in any other way. The layout for "Video Editing" does not leave enough space to open up the side panels. Following shows details including dimensions, frames, and codec:

image

Show tooltips in File Browser (both in thumbnail and list views) that provide extra information and vary by type, like video resolution and frames, etc. --- I've proposed something similar a few years ago but this approach is radically different. File Browser no longer needs any knowledge about how to examine these files or create thumbnails. Information passed around only using thumbnail metadata for images and videos. The thumbnail creation and storage method we use is a standard that includes storing textual data as well. And we currently do this for image dimensions - we just don't currently do anything with this information. This patch extends this process a bit further, storing details about images and videos in each preview's metadata. Following shows hovering over an image and seeing dimensions: ![image](/attachments/89f02dda-502b-406d-8a7a-fd3bde7cdbb0) Showing the version of Blender that saved this blend file. Note that it shows the full name, while it is truncated in the list. ![image](/attachments/6672605b-2d79-4f7a-bb57-a2676c4c4bc3) Following shows seeing video details in a situation that wouldn't allow us to do it in any other way. The layout for "Video Editing" does not leave enough space to open up the side panels. Following shows details including dimensions, frames, and codec: ![image](/attachments/bb8543cc-6f14-4a63-b7de-225fa66fb446)
Harley Acheson force-pushed FileTooltips from c757544344 to e70d751bfc 2023-02-10 00:17:08 +01:00 Compare
Harley Acheson force-pushed FileTooltips from e70d751bfc to 48c1107a8a 2023-02-10 03:58:44 +01:00 Compare
Harley Acheson force-pushed FileTooltips from 48c1107a8a to d6d405e43b 2023-02-24 03:19:45 +01:00 Compare
Harley Acheson force-pushed FileTooltips from f089288d78 to 06ac1631a0 2023-03-09 05:40:27 +01:00 Compare
Harley Acheson force-pushed FileTooltips from 06ac1631a0 to 335bb75f30 2023-03-21 00:32:11 +01:00 Compare
Author
Member

@blender-bot build

@blender-bot build
Author
Member

Note to self. If we do something like this it would be nice to later alter the font previewing code so that we include a broad category name in the meta-data. So if I am guessing it is a symbol font, include "Symbol" in something that indicates broad intent. Same with languages obviously. This could also then allow for filtering by this or even showing in an optional column.

Note to self. If we do something like this it would be nice to later alter the font previewing code so that we include a broad category name in the meta-data. So if I am guessing it is a symbol font, include "Symbol" in something that indicates broad intent. Same with languages obviously. This could also then allow for filtering by this or even showing in an optional column.
Author
Member

Harley Todo: This post includes information from Julian about how asset tooltips might look: #104693

Harley Todo: This post includes information from Julian about how asset tooltips might look: https://projects.blender.org/blender/blender/pulls/104693
Harley Acheson added this to the User Interface project 2023-04-07 19:22:16 +02:00
Harley Acheson force-pushed FileTooltips from b33c00e179 to dbc5a923dd 2023-04-11 21:59:29 +02:00 Compare
Harley Acheson force-pushed FileTooltips from dbc5a923dd to f00e214162 2023-05-18 20:34:44 +02:00 Compare
Harley Acheson changed title from WIP: UI: Dynamic File Browser Tooltips to UI: Dynamic File Browser Tooltips 2023-05-18 20:35:43 +02:00
Harley Acheson force-pushed FileTooltips from 4c6c06f2fe to ff2f9141de 2023-06-28 21:16:10 +02:00 Compare
Harley Acheson added 2 commits 2023-08-23 23:57:55 +02:00
Author
Member

This has been design approved by the UI Module, possibly with small tweaks to what is displayed (like number of file bytes, etc).

Does need code review.

This has been design approved by the UI Module, possibly with small tweaks to what is displayed (like number of file bytes, etc). Does need code review.
Harley Acheson requested review from Campbell Barton 2023-08-23 23:59:37 +02:00
Harley Acheson requested review from Pablo Vazquez 2023-08-24 00:02:26 +02:00
Harley Acheson added 1 commit 2023-09-08 21:41:31 +02:00
Pablo Vazquez requested review from Julian Eisel 2023-09-13 18:11:21 +02:00
Author
Member

@pablovazquez @brecht

It was brought up in UI Module meeting that these would be better if the filename were more prominent than the rest, perhaps bold while the rest is not and maybe include a small space to separate them.

However custom tooltips at the moment are just a single simple string. We don't currently have any fine control over the contents of tooltips.

I do have a WIP PR that allows extremely fine-grained control over tooltips. In fact allows you to construct them line-by-line, each with any color or style. And even allows images to be part of them if needed. So they could show a thumbnail in the tooltip when viewing files in list view, for example. #105905. I can update that PR if that sounds at all interesting.

@pablovazquez @brecht It was brought up in UI Module meeting that these would be better if the filename were more prominent than the rest, perhaps bold while the rest is not and maybe include a small space to separate them. However custom tooltips at the moment are just a single simple string. We don't currently have any fine control over the contents of tooltips. I do have a WIP PR that allows extremely fine-grained control over tooltips. In fact allows you to construct them line-by-line, each with any color or style. And even allows images to be part of them if needed. So they could show a thumbnail in the tooltip when viewing files in list view, for example. #105905. I can update that PR if that sounds at all interesting.
Harley Acheson added 3 commits 2023-09-14 18:11:35 +02:00

Using that other PR makes sense to me.

If the extended information is muted like the Python tooltips that would already look fine I think. But there's multiple good ways this could be styled.

Using that other PR makes sense to me. If the extended information is muted like the Python tooltips that would already look fine I think. But there's multiple good ways this could be styled.
Harley Acheson added 2 commits 2023-09-15 23:35:03 +02:00
Brecht Van Lommel requested changes 2023-09-18 16:46:02 +02:00
@ -116,0 +197,4 @@
!(file->attributes & FILE_ATTR_OFFLINE))
{
/* Load Blender version directly from the file. */
short version = BLO_version_from_file(full_path);

It's sightly suboptimal to open a file as part of tooltip drawing. On a slow network driver this could lead to a noticeable delay in display the tooltip when quickly scanning across multiple files quickly.

It's sightly suboptimal to open a file as part of tooltip drawing. On a slow network driver this could lead to a noticeable delay in display the tooltip when quickly scanning across multiple files quickly.
Harley marked this conversation as resolved
@ -1537,0 +1545,4 @@
IMB_metadata_set_field(ibuf->metadata, "Frames", value);
#ifdef WITH_FFMPEG
AVStream *v_st = anim->pFormatCtx->streams[anim->videoStream];

Can anim->pFormatCtx be null?

Should this also check anim->curtype == ANIM_FFMPEG, since there are multiple types?

Can `anim->pFormatCtx` be null? Should this also check `anim->curtype == ANIM_FFMPEG`, since there are multiple types?
Harley marked this conversation as resolved
@ -1537,0 +1553,4 @@
IMB_metadata_set_field(ibuf->metadata, "FPS", value);
SNPRINTF(value, "%g", duration);
IMB_metadata_set_field(ibuf->metadata, "Duration", value);
IMB_metadata_set_field(ibuf->metadata, "Codec", anim->pCodec->long_name);

If this metadata is specifically for thumbnails, it could use Thumb::Image for all the fields?

If this metadata is specifically for thumbnails, it could use `Thumb::Image` for all the fields?
Harley marked this conversation as resolved
Harley Acheson added 2 commits 2023-09-18 20:02:10 +02:00
Author
Member

@brecht

If this metadata is specifically for thumbnails, it could use Thumb::Image for all the fields?

I changed it so all the video metadata is like "Thumb::Video::FPS", including width and height.

It's slightly suboptimal to open a file as part of tooltip drawing

I improved it a bit, by having the blend thumbnails save with version in its metadata. That way we don't have to touch it if we have the thumbnail in our local cache. Although that makes me want to include other stats in there too now.

@brecht > If this metadata is specifically for thumbnails, it could use Thumb::Image for all the fields? I changed it so all the video metadata is like "Thumb::Video::FPS", including width and height. > It's slightly suboptimal to open a file as part of tooltip drawing I improved it a bit, by having the blend thumbnails save with version in its metadata. That way we don't have to touch it if we have the thumbnail in our local cache. Although that makes me want to include other stats in there too now.
Brecht Van Lommel approved these changes 2023-09-20 19:44:04 +02:00
Brecht Van Lommel left a comment
Owner

Seems fine to me now, but the file browser is more @JulianEisel 's area so I think this really needs a review from him too.

Seems fine to me now, but the file browser is more @JulianEisel 's area so I think this really needs a review from him too.
Harley Acheson added 2 commits 2023-09-21 01:41:41 +02:00
Harley Acheson added 2 commits 2023-10-14 03:03:53 +02:00
Harley Acheson added 2 commits 2023-10-14 23:55:07 +02:00
Harley Acheson added 1 commit 2023-11-12 18:35:27 +01:00
Author
Member

@pablovazquez

Do you mind taking at look at this and seeing anything looks funny? @JulianEisel is still going to have a quick look, but our hope is to get this in for 4.1

@pablovazquez Do you mind taking at look at this and seeing anything looks funny? @JulianEisel is still going to have a quick look, but our hope is to get this in for 4.1
Julian Eisel requested changes 2023-11-28 19:15:01 +01:00
Julian Eisel left a comment
Member

The IMB_thumb_read() & IMB_thumb_manage() calls will load data from disk. This can cause Blender to freeze since they are called from the main thread. I'm not sure how much of an issue that would be in practice, but I would suggest to at least note this in comments. Besides that, files may already have loaded the image from disk, so it's better to access it from there. See filelist_file_getimage().

The `IMB_thumb_read()` & `IMB_thumb_manage()` calls will load data from disk. This can cause Blender to freeze since they are called from the main thread. I'm not sure how much of an issue that would be in practice, but I would suggest to at least note this in comments. Besides that, files may already have loaded the image from disk, so it's better to access it from there. See `filelist_file_getimage()`.
@ -110,3 +116,2 @@
/* Dummy helper - we need dynamic tooltips here. */
static char *file_draw_tooltip_func(bContext * /*C*/, void *argN, const char * /*tip*/)
typedef struct file_tooltip_data {
Member
struct FileTooltipData {
  const SpaceFile *sfile;
  const FileDirEntry *file;
};
```c++ struct FileTooltipData { const SpaceFile *sfile; const FileDirEntry *file; }; ```
Harley marked this conversation as resolved
@ -116,0 +138,4 @@
const FileDirEntry *file = file_data->file;
ImBuf *thumb = nullptr;
if (file->asset) {
Member

I'd rather assert here, since when this is called, it would mean any asset tooltip callback was overridden by a file one.

I'd rather assert here, since when this is called, it would mean any asset tooltip callback was overridden by a file one.
Harley marked this conversation as resolved
@ -116,0 +190,4 @@
if (file->typeflag & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP))
{
char version_st[128] = {0};
thumb = IMB_thumb_read(full_path, THB_LARGE);
Member

Why is this only using _read(), instead of _manage()?

Why is this only using `_read()`, instead of `_manage()`?
Author
Member

In this case I don't want to create a new preview if one doesn't exist. Getting the version from the file is faster.

In this case I don't want to create a new preview if one doesn't exist. Getting the version from the file is faster.
@ -116,0 +214,4 @@
}
}
else if (file->typeflag & FILE_TYPE_IMAGE) {
thumb = (file->attributes & FILE_ATTR_OFFLINE) ?
Member

IMB_thumb_manage() handles the case of offline files now, it won't attempt to generate those.

`IMB_thumb_manage()` handles the case of offline files now, it won't attempt to generate those.
Harley marked this conversation as resolved
@ -116,0 +235,4 @@
}
}
else if (file->typeflag & FILE_TYPE_MOVIE) {
thumb = (file->attributes & FILE_ATTR_OFFLINE) ?
Member

Same here re offline file handling in IMB_thumb_manage().

Same here re offline file handling in `IMB_thumb_manage()`.
Harley marked this conversation as resolved
Harley Acheson added 2 commits 2023-11-28 23:42:35 +01:00
Author
Member

files may already have loaded the image from disk, so it's better to access it from there. See filelist_file_getimage()

Good idea. Thanks!

> files may already have loaded the image from disk, so it's better to access it from there. See `filelist_file_getimage()` Good idea. Thanks!
Harley Acheson added 2 commits 2023-11-28 23:47:55 +01:00
Harley Acheson added 2 commits 2023-12-08 01:41:19 +01:00
Author
Member

@JulianEisel

I updated this based on your feedback, trying to simplify and calm these a bit. I updated the captures in the first comment.

First I added a space before the date and size. This makes the custom information in the middle stand out a bit better.

I removed any labels that seemed obvious and redundant. So an image just shows "1024 x 768" without having "Dimensions: " in front of it. Similarly removed the colon for blend files so it shows "Blender 4.1" rather than "Blender: 4.1"

For the modified line it no longer shows the time unless it was saved today or yesterday. Seems less likely to need such precision further in the past.

It no longer shows the byte count unless it is under 10,000 bytes. So typical files will just show in Kb or Mb, etc.

@JulianEisel I updated this based on your feedback, trying to simplify and calm these a bit. I updated the captures in the first comment. First I added a space before the date and size. This makes the custom information in the middle stand out a bit better. I removed any labels that seemed obvious and redundant. So an image just shows "1024 x 768" without having "Dimensions: " in front of it. Similarly removed the colon for blend files so it shows "Blender 4.1" rather than "Blender: 4.1" For the modified line it no longer shows the time unless it was saved today or yesterday. Seems less likely to need such precision further in the past. It no longer shows the byte count unless it is under 10,000 bytes. So typical files will just show in Kb or Mb, etc.
Harley Acheson added 1 commit 2023-12-30 20:48:04 +01:00
Harley Acheson added 2 commits 2024-01-03 01:22:55 +01:00
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
b71356e06d
Updated to current state of main. formatting change.
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson merged commit cd4328dd82 into main 2024-01-03 03:56:23 +01:00
Harley Acheson deleted branch FileTooltips 2024-01-03 03:56:25 +01:00
Sign in to join this conversation.
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
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#104547
No description provided.