assign material from asset browser

I've created several materials, mark them as asset and group them in a catalog.

How do I iterate and assign these material from asset browser to an active object using Python?

Later on I would like to render the objects one by one after changing the material, hence the need to iterate on these materials.

  • 1
    $\begingroup$ I do not unfortunately have an answer, but I am having the same issue. Did you find a solution to it? $\endgroup$
    – Tat
    Feb 28 at 13:33

1 Answer 1


There seems to be limited documentation on how to access the Asset Browser via Python, but I found that you can access the asset_data property (of type bpy.types.AssetMetaData) on objects and materials to get information about their location in the Asset Browser. Here's a simple script that iterates over all the materials contained within the catalog named "Color Library" in the Asset Browser and assigns each material one at a time to the selected object and does a render. The rendered images will be named render_(material-name).png and be stored in the path specified by the directory variable.

import bpy
import os

directory = r'/path/to/render_directory/' #example: r'C:\Users\xxxx\Desktop'
scene = bpy.context.scene
o = bpy.context.object

def render(image_name):
    #scene.frame_current = 1
    scene.render.filepath = os.path.join(directory, f'{image_name}')
    scene.render.image_settings.file_format = 'PNG'
    print("rendering file:", scene.render.filepath)
    bpy.ops.render.render(animation=False, write_still=True)

def iterate_asset_browser_and_render():
    for m in bpy.data.materials:
        data = m.asset_data
        if not data or not data.catalog_simple_name.startswith('Color Library'):
        if not o.material_slots:
        o.data.materials[0] = m


You must log in to answer this question.

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