7
$\begingroup$

Given a datablock foo, how do I determine which other datablocks are referencing it? foo.users will tell me how many references there are, but do I have to loop through every other datablock in the file to find those references? If so, can anyone recommend a reasonably generic way of doing this given the different interfaces of various datablock types?

For my specific application I'm trying to find and delete (or modify) datablocks with names matching a pattern. I'm mostly interested in node groups and images, which seem to acquire hidden users more easily than other objects, but this type of functionality seems generally useful.

$\endgroup$

1 Answer 1

3
$\begingroup$

There is no way, internally Blender also doesn't store this data for easy access.

However some data types have convenience properties added to them to access some of the users.

  • Object.users_scene
  • Object.users_group
  • Object.children

Are handy in many cases, but specific to object types.

$\endgroup$
1
  • $\begingroup$ This is further complicated by the fact that you can't assume the same type of user for a particular datablock (e.g. an image could be used by both a texture as well as a compositor node). $\endgroup$
    – Fweeb
    Sep 9, 2013 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.