2
$\begingroup$

I am writing an addon where I need to show to the user all the objects in a specific blend file.

The best option for this is of course the asset browser, but the blend file is in a folder with other blend files, and all of them have objects marked as assets.

I know I can use tags to filter out the unwanted assets, but with the python API, there seem to be no way at all to filter anything with the asset browser but the type of datablock. There is a way to show the filter field to the user, but no apparent way to edit it's content.

I tried to take a look in the collections given to the template_asset_view, but even clearing the submitted collections doesn't change the displayed assets.

The one and only relevent reference to the asset browser I could find in the documentation is this: https://docs.blender.org/api/current/bpy.types.UILayout.html?highlight=asset#bpy.types.UILayout.template_asset_view

$\endgroup$

1 Answer 1

0
$\begingroup$

So from what I understand your problem is that the .blend is in a folder with other .blend files with other objects, or 'assets' inside them and your script is picking up all of the assets in all files within that folder?

A potential solution may be to do this on an individual file basis rather than searching through a whole folder. Make the user of the add-on select the file first, then check that specific file rather than the whole folder for assets. I don't know much about this, but from my experience that may fix your problem.

$\endgroup$
1
  • $\begingroup$ You understood correctly: My .blend is in a folder with other .blends. And i can't (it would be dirty, I prefere not to) just isolate the desired .blend file through OS functions. I took a look to this approach, but the asset browser seems to work the other way around: Select a folder to use as a library, and display the folder's content. Thus, I can't ( or don't know how to ) select just one blend file to act as a library. But if there is a way, it would actually solve my problems. $\endgroup$
    – Asloric
    Commented Jul 9, 2022 at 18:43

You must log in to answer this question.

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