Asset broswer won't show the previews when asset was marked in a background blender #93893
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
8 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#93893
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
System Information
Operating system: Windows-10-10.0.22483-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 472.47
Blender Version
Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash:
f1cca30557
Worked: (newest version of Blender that worked as expected)
Short description of error
Only generate previews when open blender and set them in outliner/python
use
bpy.ops.wm.previews_batch_generate()
for these files will not work(Error below).Exact steps for others to reproduce the error
running this script to mark every object in a blend file as asset
Added subscriber: @1029910278
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @JulianEisel
Didn't investigate yet, but my suspicion is that the file is saved before the previews are done generating. This would also be possible to happen for regular GUI use, if the user saves the file fast enough after generating previews. There's no nice solution here I think - either we wait with saving the file until the preview jobs are done, or we accept that the previews are not finished properly. I think waiting is better, even if that can be annoying. For scripts we could make the waiting optional.
Actually I use a wait to execute script. I am not sure whether saving file will break generating previews.
Added subscriber: @dr.sybren
This makes the current process wait for the sub-process. It doesn't make the sub-process wait with saving until the preview generation is done. In other words: something waits, but not for the right thing.
The waiting should happen between the calls to
o.asset_generate_preview()
andbpy.ops.wm.save_as_mainfile()
.Also, never do this:
This hides any errors that may occur, regardless of whether they're expected or not.
Added subscriber: @hughetop
I'm running into this issue as well when trying to create library assets programmatically. Looping over selected objects like:
The assets correctly export and the library updates, but none have previews because they are generated in a background thread and aren't ready by the time the
bpy.data.libraries.write
function is called. Since there's no way to force it to wait for the preview to finish (evenobj.preview_ensure()
just returns a blank image), is there a way to tell if the preview actually exists? I'm trying to do something like:but I have no idea how to tell if the preview is actually finished generating. It seems to immediately create a blank image so
obj.preview.image_pixels
is never empty.So is there any way right now to wait for the preview to finish generating, or programmatically determine if the preview is not blank?
Edit: found on a forum post, here's what my
preview_finished
function is doingIt's hacky but I'm hoping there will be a more elegant way to do this in the future.
Added subscriber: @DanielGrauer
Is this solved by
2fba27e6d8
(since now this is not run as a job when in background)?@DanielGrauer @hughetop @1029910278 : could you re-check this in a fresh 3.6 build from https://builder.blender.org/download/daily/ ?
This seems to work for me, all the previews show properly with 3.6 builds when i generate them in the background.
good to hear, will wait a bit for others to confirm (in case of no reply, will close in a bit...)
Seems to work with the blender-3.3.6-stable+v33.948f8298b982-windows.amd64-release build. Sorry for the duplicate account, I switched companies (and therefore email addresses).
Good to hear it is working for you as well, so I think we can close now.