Is there a way to quickly create simple thumbnail images for objects or materials? I ask because Blender 3.0's asset manager doesn't always reliably create thumbnails for items marked as Assets, and I've never been able to get Blender to create thumbnails for assets downloaded from Blenderkit. Thanks! Blender 3.0, Windows 11
The thing is asset previews are generated in a different thread than the main Blender thread. The nice thing is it doesn't hang when you mark a bunch of assets at once. The bad thing is you have to wait until all previews are generated to work on something else otherwise the generation process will never correctly terminate.
Shameless Plug This is inspired by my Asset Browser Utilites addon.
In the Text Editor copy and paste this script :
import bpy import numpy as np import functools assets = [o for o in bpy.data.objects if o.asset_data] # Select all object assets assets.extend([m for m in bpy.data.materials if m.asset_data]) # Select all material assets def sleep_until_previews_are_done(assets, callback): while assets: # Check if all previews have been generated preview = assets.preview if preview is None: assets.asset_generate_preview() return 0.2 # If the preview is all black, means it was not generated : arr = np.zeros((preview.image_size * preview.image_size) * 4, dtype=np.float32) preview.image_pixels_float.foreach_get(arr) if np.all((arr == 0)): assets.asset_generate_preview() return 0.2 else: assets.pop(0) callback() return None def message_end(): def draw(self, context): self.layout.label(text="All previews have been generated !") bpy.context.window_manager.popup_menu(draw, title="Generation Finished") if __name__ == "__main__": bpy.app.timers.register( functools.partial( sleep_until_previews_are_done, assets, message_end ) )
Then click on the Play button to force generating previews :
Note for the future : Blender 3.3 will have a bpy.app.is_job_running function to know if a background render is going on. https://wiki.blender.org/wiki/Reference/Release_Notes/3.3/Python_API