Page MenuHome

UI: Blend Preview Thumbnails Showing Workspace
ClosedPublic

Authored by Harley Acheson (harley) on Feb 22 2021, 3:44 AM.
Tokens
"Love" token, awarded by Stig."Love" token, awarded by gilberto_rodrigues."Like" token, awarded by activemotionpictures."Love" token, awarded by jfmatheu."Love" token, awarded by HooglyBoogly."Love" token, awarded by tintwotin."Love" token, awarded by manitwo.

Details

Summary

This adds an option to use a capture of the entire main window as the
blend file preview thumbnail.


This patch changes Blend thumbnails to be a capture of the entire active window. The idea is that this does a better job representing the project as it is at any moment in time. It is very fast since it does not require rendering the scene, and works with non-rendered projects like Video Editing,

More specifically this changes the current user preference boolean of saving previews into an enum. so u.flag USER_SAVE_PREVIEWS is deprecated, replaced with an enum so the user can select "None", "Screenshot", or "Camera View".

The following capture shows the Preference set to "Camera View", which is the current default type. Bottom right shows how that preview looks in the File Browser:

The following capture shows the preference set to "Screenshot", default once this patch is applied. Bottom right shows how that preview looks in the File Browser:

Note that the best way to test, once you have this compiling, is just to open any of your existing files, select "File / Save" to update the thumbnail, then immediately select File / Open to see the new thumbnail in File Browser.

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) requested review of this revision.Feb 22 2021, 3:44 AM
Harley Acheson (harley) created this revision.
Aaron Carlisle (Blendify) added inline comments.
source/blender/blenkernel/BKE_main.h
273

This is a change you split into a different patch

Updated to current state of master and to not change the thumbnail size - this is not possible to change in the short term.

Harley Acheson (harley) edited the summary of this revision. (Show Details)Feb 22 2021, 9:32 PM

Back to saving filesystem thumbs of 256x256, while the versions inside the blend file continues to be 128x128.

I quite like the idea, definitely makes the thumbnails more useful. It adds helpful context and works better with cases like VSE only files.

Issue is that I see use-cases where you would want to only see the scene, not the UI. There are also users who do not load .blend files with the UI. That's why we have the "Load UI" option in the file opening operator and in the Preferences.
We could do something similar for the saving: Add an operator option for the saving, and if needed a Preferences option.

@Julian Eisel (Severin) - It adds helpful context and works better with cases like VSE only files.

I tried capturing just the contents of the largest editor. That worked in many cases, but not enough. I then tried using the largest editor only if over an amount of area, like 33% of total, and doing the entire screen otherwise. But that resulted in a bit of a mish-mash.

I also liked how this gives fairly consistent proportions to them, which made it easier to compare them - something I hadn't thought of. It is a bit jarring when they differ because your brain wants to know why they different. I couldn't think of any way of cropping the result to be more square without cutting off something important. Stretching was horrible too. An interesting thought I did not explore was to simply the display a bit before capture and restore afterward, so turning off overlays etc. But in the end I just liked it being a perfect capture.

I also like the thought of this just being different from the other thumbnails. So blend could look like this, objects could be a solid (random color perhaps) render, mesh could be wireframe, etc to make them all distinct.

Issue is that I see use-cases where you would want to only see the scene, not the UI. There are also users who do not load .blend files with the UI. That's why we have the "Load UI" option in the file opening operator and in the Preferences.

Not arguing against that, but not sure. The "Load UI" is something you select while loading; the blend file itself continues to contain the UI whether you load it or not. I guess I mean the thumbnail does show the file as it is, even if you don't load it all. Or, thought of differently, it might be the arrangement that you see in the thumbnail that causes you to deselect "Load UI". So this new thumbnail type helped in that decision.

We could do something similar for the saving: Add an operator option for the saving, and if needed a Preferences option.

Yes, that is an option. I just love the idea of ripping that code out of there for something simpler. If the preference is for a render of the scene then we are stuck with having to do things differently if no camera. And I don't like the thought of users having to choose something different just because they are working without a 3DView, like with VSE

@Julian Eisel (Severin):

Another example that I don't like quite as much is to ED_screen_state_toggle before and after capture of the largest editor:

It does show a bit more of the scene and still works most of the time for VSE, depending on the layout. But I miss seeing the layout now...

Surprisingly, thumbnails of this size that capture the entire UI could be used like this...

The above seriously just a 256x146 image blown up to full size, blended with a solid mid-gray layer.

Some notes:

  • Interested to know if some users prefer the existing behavior (as already suggested, this could be a preference).
  • Is there a sane default when used with multiple windows?
  • The patch needs updating for master.
  • Is image scaling ever a performance bottleneck? Someone users might have a blender window spread across 2x 4k monitors for e.g, I'd prefer even in less common cases that this doesn't cause a noticeable performance hit. If so, we should be able to work-around this.

Updated to current state of master.

@Campbell Barton (campbellbarton) - Interested to know if some users prefer the existing behavior

I haven't noticed any yet, but that is probably just because there is a lot of room for improvement with them. So there might be other solutions they would like even better, but I haven't (yet) found any yet that work better than this one.

Unexpected is how well this helps illustrates project change. So if you look through thumbnails of multiple versions of the same project in progress it really helps show where you were at at the time you left it.

Another interesting plus of this is that by showing the layout it helps in deciding on whether you want to "Load UI".

... (as already suggested, this could be a preference).

For sure, I just hate adding new preferences, and one here might be a bit awkward. Could perhaps make this an experimental feature for a time to gauge response.

Overall this seems to do well at illustrating the project, no matter what type or what you are doing. The only time I can see it not being a big plus is when the file is being presented to someone else. Like downloading a blend containing a particular object, seeing the author's workspace is a bit odd.

But for people with very specific needs - if there are people who absolutely need a particular kind of thumbnail - an addon could maximize an area before saving and restore afterward? Or we could think of other ways for python addons to help with specific needs. Just not sure how many people find it important enough to have a specific thumbnail.

Is there a sane default when used with multiple windows?

Hmmm... this is only capturing the current window, so generally would be whatever window you selected File/Save from. So if you hit shortcut ctrl-S while viewing Preferences it will capture that window. I could follow wmWindow.parent to find one that is null I suppose, if we don't already have a way to get to main window. But if you have multiple main (unparented) windows? Maybe I should use the first window that is without parent.

Is image scaling ever a performance bottleneck?

I haven't actually timed it, but should. The alternative solutions that include making the offscreen renders better just take sooooo long while this is done in an instant and is a fairly constant time. But will test. Worst case will be a single main window stretched over multiple monitors.

Now makes sure to capture a main window, not a child.

Harley Acheson (harley) retitled this revision from UI Experiment: Full-Layout Blend Thumbs to UI: Blend Thumbs showing Workspace.Mar 27 2021, 7:58 PM

updating to current state of master.

Harley Acheson (harley) planned changes to this revision.Apr 22 2021, 12:01 AM

This seems better in most cases but worse when distributing a specific thing. For example if I am downloading a model I don't need to see the author's UI.

If there is an option to not do thumb creation then can add this as a third option, make default perhaps. Not seeing such an option in a quick look, but will search a bit more later.

Now the user can specify whether they want no previews, rendered, or workspace (default).

Campbell Barton (campbellbarton) requested changes to this revision.Apr 26 2021, 3:55 AM

Tested a window across 2x 4k monitors, it took a little over 1/10th of a second, although my system is fairly recent - this is more a worst case,
if scaling is ever an issue in the future, it could be further optimized.

Other replies inline.

source/blender/makesdna/DNA_userdef_types.h
1019–1021 ↗(On Diff #36493)
  • WORKSPACE

    The name workspace is a bit odd here, workspaces are a spesific feature in Blender and can contain multiple windows. Where as this screenshots the current window or it's parent.

    Perhaps WINDOW or SCREENSHOT ?
  • RENDERED implies it might use rendered shading type, or some rendering.

    Suggest CAMERA or CAMERA_VIEW as the exact kind of shading isn't so important.

Would also use prefix USER_FILE_PREVIEW_* or USER_BLENDFILE_PREVIEW_* to distinguish this from asset/data-block previews.

source/blender/makesrna/intern/rna_userdef.c
6241 ↗(On Diff #36493)

As there are preview preferences, I think this should be more obviously for blend files only, suggest blendfile_preview_type (or file_preview_type - matches use_file_compression).

source/blender/windowmanager/intern/wm_files.c
1350

Prefer naming which more clearly differentiates the two functions.

eg:

  • blend_file_thumb_from_screenshot
  • blend_file_thumb_from_camera
This revision now requires changes to proceed.Apr 26 2021, 3:55 AM

Thanks @Campbell Barton (campbellbarton)! I could tell that some of the naming here was a bit dodgy and needed some help. Probably needed more coffee.

Harley Acheson (harley) edited the summary of this revision. (Show Details)

Updated to address everything mentioned by @Campbell Barton (campbellbarton). Naming is much better, but probably could still be improved.

Campbell Barton (campbellbarton) requested changes to this revision.Apr 28 2021, 2:42 AM
Campbell Barton (campbellbarton) added inline comments.
source/blender/blenloader/intern/versioning_userdef.c
889 ↗(On Diff #36570)

This will set the value every file load, instead this should do a sub-version bump.
Also the existing flag should be respected - so if previews are disabled they will remain disabled.

Then the flag can be cleared at the same time so it can be re-used later.

source/blender/makesdna/DNA_userdef_types.h
660 ↗(On Diff #36570)

Remove.

932–933 ↗(On Diff #36570)

No need to add extra pad, this can be a char, just reduce _pad10 by one.

1003 ↗(On Diff #36570)

Should note the flag is /* dirty */

source/blender/makesrna/intern/rna_userdef.c
6081 ↗(On Diff #36570)

"Capture the entire window"

source/blender/windowmanager/intern/wm_files.c
1350

const C causes warning with WM_redraw_windows.

This revision now requires changes to proceed.Apr 28 2021, 2:42 AM

Updated to incorporate all the requests by @Campbell Barton (campbellbarton) and small comment changes. And using "USER_FILE_PREVIEW_SCREENSHOT" instead of "USER_FILE_PREVIEW_WINDOW"

This revision is now accepted and ready to land.Apr 28 2021, 5:41 AM

Note that changing the default is still waiting on feedback from artists in the blender-institute studio as discussed last meeting.

Note that changing the default is still waiting on feedback from artists in the blender-institute studio as discussed last meeting.

Yes, absolutely. It is far more important that actual users think it useful.

Updating to current state of master. Also keeping the current thumbnail type as the default.

Updating to current state of master.

Harley Acheson (harley) retitled this revision from UI: Blend Thumbs showing Workspace to UI: Blend Preview Thumbnails Showing Workspace.Sep 6 2021, 6:02 AM
Harley Acheson (harley) edited the summary of this revision. (Show Details)