How can I see all the "users" of a datablock? Is it possible with the Blender's UI? With Python?
For example, I'd like to know which 3 objects are the users of my material:
How can I see all the "users" of a datablock? Is it possible with the Blender's UI? With Python?
For example, I'd like to know which 3 objects are the users of my material:
Without Python:
You can simply select one of the objects and use Shift+L > Material to select all the objects that share the same material. If the object has more than one material, it'll check for the one that's currently active.
With Python:
It's a bit of a workaround. Each material has the attribute users
, but this is only the number of users and not actually a list of objects/data.
So in order to get a list of all the objects that use a certain material, we have to loop through the objects, then through each object's material slots:
import bpy
objects = bpy.context.selectable_objects
mat = bpy.context.object.active_material
for obj in objects:
for slot in obj.material_slots:
if slot.material == mat:
obj.select = True
Shift L
> Material. $\endgroup$