Python Scripting with the new Asset Manager

Hi there :slight_smile: a quick question about whether its possible to subscribe to events like a new asset being introduced into a scene? So far the only updates I can see are triggered are from the depsgraph, but these can be triggered in many ways and don’t provide contextual information about what operation caused the update, they merely advise that a set of data blocks has been changed somehow.

Ideally, it would be great to know when an asset is dropped and be able to react to that. So far I can’t see another way of doing this than using a depsgraph handler though. Am I missing something?

I have read up on drag and drop development in Blender here → Window-Manager: Rewrite Drag & Drop System [WIP] which talks about D&D being extensible, possibly by scripts? This would be ideal if we could handle drag and drop in our own scripts for tools such as what I am working on.

Any help on this would be appreciated very much!

Thanks!

2 Likes

Ok, another question for someone, maybe @julianeisel? I am wanting to use the assets from the asset manager in scripts, but can’t find where assets are kept/organised in the python API, is it possible to iterate over them or be able to add the currently selected asset in the browser via the python API, I’ve tried but can’t see any way of doing this.

Basically, the Python API isn’t there for such things yet. There are just a few bits and pieces that are needed for the first milestone.
We’ve started the design process for the actual asset system (which would decouple the design from the File/Asset Browser, allow dynamically registering asset libraries, integration with online markets via Python, custom drag/drop operations from Python, etc.). As part of that we’re also trying to figure out the basic Python API design. The current planning foresees that most of this should be there for 3.0.

3 Likes

Also note that the current Asset Browser implementation is considered experimental (but enabled in Alpha builds by default):


So designs and the existing API bits may change still.

1 Like

Hi @julianeisel thanks for the quick reply, very much appreciated :). Since we’re going to be an early adopter of such an API, is it possible to collaborate with you guys? Happy to be interviewed as a potential ‘user’ of this API.

It’s awesome to hear that you are planning to allow access to register custom asset libraries from the Python API with the 3.0 release. Is there any design document that explains how you are planning to do this? I have several libraries that I would like to try this out with. I know 3.0 is a little ways out, but I would love to be part of the discussion and provide feedback.

2 Likes