1

Please tell me. How to remove unused materials in all objects if the objects are not selected?

I tried this code but didn't get what I wanted. This code does not remove unused materials in unselected objects.

How to remove all unused material slots from all objects?

Correction. All unused slots in all objects

Ruslan
  • 11
  • 2
  • It's rather a problem of setting the object as active, not selected. Does this work ? https://blender.stackexchange.com/a/210499/86891 – Gorgious May 09 '23 at 15:30
  • This also only works on selected objects. I would like at best to unused material slots have been removed from all bpy.data.objects – Ruslan May 10 '23 at 07:10
  • A variation of this answer then ? https://blender.stackexchange.com/a/129155/86891 – Gorgious May 10 '23 at 07:55
  • This script also removes unused material slots for selected objects only. Thanks for trying to help. – Ruslan May 10 '23 at 13:34
  • Hehe you're right. I've added an answer to the other Q&A. See if it helps you https://blender.stackexchange.com/a/292562/86891 – Gorgious May 10 '23 at 15:02
  • Yeees. Hooray It worked, thanks a lot. – Ruslan May 10 '23 at 15:19
  • Hi, Rusian, welcome! .. it looks as though you have a fix, thanks to @Gorgious, so the linked archive now qualifies as a genuine duplicate, and this post can be closed. If for any reason you disagree, edit to point out the distinction, and we can re-open. – Robin Betts May 11 '23 at 07:52

1 Answers1

0

Gorgious Helped me find the answer. Here is the answer to my question

Delete all materials that aren't assigned to a face?

Ruslan
  • 11
  • 2