How can I fix this via script? In this case the materials are all in use on an object, but they are the same material on multiple face, I would like to simplify it in 1 material only:
Edit:
in order not to make this question a possible duplicate, I want to specify that in this case I would like to iterate all the objects in the scene, and look for possible duplicate slots.