UI: Improved Preview Feedback and Reduced Flickering #108486
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#108486
Loading…
Reference in New Issue
No description provided.
Delete Branch "Harley/blender:BrowserWait"
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?
Show File & Asset Browser items that are in progress with a "waiting"
icon. Reduces flickering and improves feedback for failed thumbnails.
When viewing File and Asset Browser items in thumbnails mode you can see a "flickering" of white as they load, even if all items have previews. This is because the initial state for all items is a generic "document" icon that is mostly white. This icon is shown until the thumbnail is made or found, but also remains showing if there is an error creating it - which looks like it is just taking forever.
This PR makes the initial icon look like a "waiting" icon. It is shown without the outer document image to reduce the visual weight. This also means that errors will progress from "waiting" to the generic icon so better signals the condition.
The following is a (slowed down) capture of how it looks now:
And this is what this PR looks like similarly slowed down:
The patch does makes the problem less noticable, but it feels like is a palliative solution. The recalculate of thumbnails is clearly happening in occasions where it shouldn't need to
The extreme example::
In this case we are not even changing the folder, yet the thumbnails cannot be drawn correctly for a draw cycle or so.
Just to be clear, this could go in anyways since it is a nice improvement. It just doesn't fix the bigger problem.
Showing the waiting icon is quite an improvement. For me less so because of the flickering, more because you never knew if a preview was still loading or if there simply was none.
One issue I see, until now you'd at least know the file/ID type even while loading, which can be useful if loading takes a moment (e.g. with many assets or when loading over a network). That info is lost now. We could show the loading icon like in this patch, and the type icon in the lower left corner, like we do when the preview is loaded. @pablovazquez, opinion?
Yes, that is my original idea for this when I made #107380
Lets replace that "loading" icon with the type icon!
That's what I've done in #107576:
But think we should still show a waiting icon to be clear what's going on. For assets without preview we should also get rid of the big "file" icon in the back, since this doesn't represent files. We can show either an asset type icon like above or some default image when there is no preview.
So I think I'd still vote for loading icon + type icon in the lower left.
@JulianEisel - So I think I'd still vote for loading icon + type icon in the lower left.
Yes, updated this PR to do so and it works quite well. I also updated the animated gif in the original comment showing what it looks like.
I quite like this current version.
Found an issue with the icon colors in
main
, fixed witha6e1caa1b2
. (Probably conflicts, sorry about that.)Some minor changes requested.
@ -458,2 +457,2 @@
icon_color[2] = 255;
}
UI_GetThemeColor4fv(TH_BACK, bgcolor);
bool dark_bg = rgb_to_grayscale(bgcolor) < 0.5f;
const
, also for the following vars.@ -459,1 +457,3 @@
}
UI_GetThemeColor4fv(TH_BACK, bgcolor);
bool dark_bg = rgb_to_grayscale(bgcolor) < 0.5f;
bool is_loading = file->flags & FILE_ENTRY_PREVIEW_LOADING;
Would move this to the top of the function, together with
is_loading
.@ -460,0 +459,4 @@
bool is_loading = file->flags & FILE_ENTRY_PREVIEW_LOADING;
uchar icon_color_dark[4] = {0, 0, 0, 255};
uchar icon_color_light[4] = {255, 255, 255, 255};
uchar *icon_color = (dark_bg && !is_loading) || (!dark_bg && is_loading) ? icon_color_dark :
Something reads wrong here: When the background is dark, we use a dark icon color?! I guess it works because we happen to be drawing a light document image in the back earlier. This dependency should be made explicit, so there are no surprises.
With
a6e1caa1b2
in, I suggest to add ahas_document_img
boolean and check that to determine if eitherdocument_img_col
orbgcolor
should be used for the grayscale check.3991d423c2
to705f23eb91
@ -413,3 +414,3 @@
}
else {
UI_GetThemeColor4fv(TH_TEXT, document_img_col);
UI_GetThemeColor4fv(is_loading ? TH_BACK : TH_TEXT, document_img_col);
This seems wrong. It's repurposing
document_img_col
for when there is no document image, and it's not clear what this has to do with the loading state.Should be much clearer now.
I found a bug introduced with this patch. If my asset has no thumbnail, it doesn't refresh right away from the "loading" thumbnail into the generic thumbnail. I need to mouse over the main asset browser region to fix it.
Thanks for testing this!
Hard to explain this well. The issue you describe is definitely a bug in that it is showing you something incorrect. But it is not that this PR introduces it, more that it exposes an existing issue, which is what we were hoping for to be honest.
With current code that item would start with that generic thumbnail, try to create a better one, fail, and you'd be left with what you started with. That the area didn't refresh after the failure isn't something you could notice because the starting and ending image was the same. Now that we are distinguishing between "in-progress" and "done" that lack of refresh is noticed.
I have updated this PR to fix two issues related to this. First there were times when a preview was loaded (or not) but the area was not redrawn under some circumstances when it should have been.
The other is that we are treating internal items (FILE_TYPE_BLENDERLIB) that are also directories as previewable, but they are not. This resulted in the new "waiting" icon and the file id corner icon shown during a brief period when loading.
In testing this I am no longer seeing the issue you mention, but I am hoping you can give it a test too.
+1 ! Nice one.
Offtopic: In another patch, it'd be interesting to test having always a (maybe darker) background on the assets, similar to the hover effect. Otherwise it seems like a bunch of icons dangling in space.
Crappy mockup:
@ -1630,2 +1630,2 @@
if ((entry->typeflag & FILE_TYPE_BLENDERLIB) &&
(entry->flags & FILE_ENTRY_BLENDERLIB_NO_PREVIEW)) {
if (entry->typeflag & FILE_TYPE_BLENDERLIB &&
((entry->flags & FILE_ENTRY_BLENDERLIB_NO_PREVIEW) || (entry->typeflag & FILE_TYPE_DIR)))
This makes the
if
statement unnecessarily complex and the comment above has no relation to this. Try to makeif
statements check one coherent condition, not multiple ones. So better make this a separateif
statement with its ownreturn
.@ -360,2 +360,3 @@
case ND_SPACE_FILE_PREVIEW:
if (sfile->files && filelist_cache_previews_update(sfile->files)) {
if (sfile->files) {
filelist_cache_previews_update(sfile->files);
I would leave this where it is and simply set the
changed
bool infilelist_cache_previews_update()
to true when removing theFILE_ENTRY_PREVIEW_LOADING
flag. This can avoid a bunch of unnecessary redraws/refreshes.