# How to find the users of a material?

There are a few materials in a blend file I have that I don't think are necessary in the file. However, none of these materials show up in orphan data. I know something is using these materials because if I add the material to another object, it will show a 2 in the material slot (for those who don't know, this means that 2 items are using the material. One of these is the object I plugged it into and the other one is what I want to figure out.) I checked all the meshes in the file and couldn't find a single one that was using the materials I think are not needed. None of these materials have any fake users either. How can I find what is using the material so I can be sure that I can delete it?

• Hard to say without seeing the file, but a material can be referenced in several places, for instance in the render passes override or in geometry nodes Jul 15 at 6:32
• To be sure it is not assigned to anything: if you're choosing a material slot on an object and use the dropdown menu to assign a material, is the one in question there marked with a 0 in front of the name? If not, then it's assigned to something, whatever that might be (as @Gorgious pointed out, it's not necessarily a mesh object). Jul 15 at 9:23
• @GordonBrinkmann There is no 0 in front of the material Jul 20 at 23:09
• Then it's most likely assigned to something... Jul 20 at 23:47
• @GordonBrinkmann How can I figure out what it is? I checked all the meshes and couldn't find any that were using the material. Jul 21 at 1:16

This appears to be the same question as How to find out what is using an image except that it's for materials rather than images. The first answer there, in the form of a python script, will solve this as well; by replacing the image bits with material bits.

Copy and paste script block into text editor and run it. Output written to system console:

import bpy
from bpy.types import bpy_prop_collection

def search(ID):
def users(col):
ret =  tuple(repr(o) for o in col if o.user_of_id(ID))
return ret if ret else None
return filter(None, (
users(getattr(bpy.data, p))
for p in  dir(bpy.data)
if isinstance(
getattr(bpy.data, p, None),
bpy_prop_collection
)
)
)

# report all materials and their users in the console
for mat in bpy.data.materials:
print (20*"-")
print(repr(mat))
print("Users:", mat.users)
for users in search(mat):
print(users)


Console output (default scene):

--------------------
bpy.data.materials['Dots Stroke']
Users: 2
("bpy.data.brushes['Airbrush']", "bpy.data.brushes['Pencil Soft']")
--------------------
bpy.data.materials['Material']
Users: 1
("bpy.data.meshes['Cube']",)


Credit goes to @batFINGER, see How to find out what is using an image in a blend file

• @brockman deserves half the bounty for updating the python to use mat.* Jul 21 at 21:34
• No problem, was dead easy to adapt it. Jul 21 at 21:35
• lol, thought this was the question I answered. Cheers for the cite. Appreciate the feedback. Jul 23 at 14:34