I need to rename all the SubMaterials in scene adding a "Sub_" prefix.
To doing this, I wrote a simple script:
for o in sceneMaterials do ( if (classof o == Multimaterial) then ( for i in o.materialIdList do ( try ( subo = o[i] subo.name = "Sub_"+subo.name ) catch() ) ) )
But the problem is that sometimes, a submaterial is an instance of another material in scene and if I rename the submaterial, the master material is renamed too.
So, how can I check if the submaterial is an instance and, if it is, make it unique and then rename it?
Someone could help me, please?