I am trying to write a little script that checks if mesh has more than one material, and if it does, remove materials until there is only one left on the item. Here is what I have so far:
import bpy
for ob in bpy.data.objects:
number_of_mats = len(ob.material_slots.items())
if number_of_mats > 1:
for i in range(number_of_mats-1):
# remove material here?
I cannot seem to figure out the method to remove a mat at this point. Any suggestions?