2
$\begingroup$

When marking assets by python api, the icon does not show properly in the asset browser can not see the thumbnail. But I can mark the asset.

       obj = bpy.data.objects["dishwasher1"]  
       obj.asset_clear()
       obj.asset_mark()

Any one can help on this?

$\endgroup$
1

1 Answer 1

4
$\begingroup$

Let's have a look at what Python Console suggests with autocomplete:

enter image description here

object.asset_generate_preview() looks interesting.

$\endgroup$
3
  • 1
    $\begingroup$ A link to the method docs for completeness : docs.blender.org/api/current/… $\endgroup$
    – Gorgious
    Sep 21, 2022 at 8:41
  • 3
    $\begingroup$ Note the generation is asynchronous so you won't be able to access the image data directly after calling asset_generate_preview but you can use application timers to wait for a bit for the preview to render. $\endgroup$
    – Gorgious
    Sep 21, 2022 at 8:48
  • $\begingroup$ Absolutely worked out! Fantastic! $\endgroup$
    – Derekcbr
    Sep 21, 2022 at 10:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .