7

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.

iKlsR
  • 43,379
  • 12
  • 156
  • 189
jedfrechette
  • 158
  • 4

1 Answers1

3

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.

ideasman42
  • 47,387
  • 10
  • 141
  • 223
  • 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). – Fweeb Sep 09 '13 at 05:06