I need help writing a python script for speeding up my workflow, I have this imported object with dozens of broken materials, and I need a way to:
1 - Go through each material nodetree on selected object, delete everything and replace with a random diffuse color, so I can work on it later but have visual reference of parts (like color A its gonna be metal, B wood...);
2 - Join materials with the same name into a single one, keeping the nodetree from the lowest number (like wood, wood.001, wood.002...).
The second one i have found a few similar examples here, the first is what I have no idea how to do.