Asset catalog management is unusable in Python

The bpy interface for working with catalogs is basically unusable for automating tasks.

I have a large asset repository that I’m creating programmatically using Python scripts, but there’s no sane way to do simple catalog operations like adding a new collection to the current file and moving assets into them. The only way to interact with the catalog system is via the ops module which is not designed for real automation.

One of the “solutions” I’ve seen for trying to work around this is a total disaster (How to create a new catalog in the Asset Browser using Python? - Blender Stack Exchange).

I would suggest adding a new module, bpy.assets, that can introduce a stable API for real asset catalog automation.

2 Likes

I agree that a proper api to work with asset catalogs would be very helpful!

In the meantime, I made this helper file to make creating and modifying the underlying blender_assets.cats.txt easier, It might also be helpful for your project:

That’s great for managing the catalogs themselves, but how does one move an asset into one of the catalogs once they’re made?

asset.asset_data.catalog_id = catalog_uuid ?

https://docs.blender.org/api/current/bpy.types.AssetMetaData.html#bpy.types.AssetMetaData.catalog_id

1 Like