De-Instance materials
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?
Thanks,
David
Comments
To find all instances of a
To find all instances of a material check this
To make material unique see what is written in maxscript help file:
assignNewName <material>
Modifies the name of the specified material to make it unique. The name is of the form "Material #1" where the number is incremented as required to make ensure it’s unique.
Tools and Scripts for Autodesk 3dsMax
Tried using assignNewName,
Tried using assignNewName, but it doesn't make the submaterial unique. It rename both submaterial and master material as "Material #n".
I think I found a sloution:
The first slot in Material Editor is a multisub. All submaterials are instances of subMat[1]
Tools and Scripts for Autodesk 3dsMax
Same behaviour here. Maybe we
Same behaviour here. Maybe we don't know how to use it. I started a thread in cgtalk. Hope someoane to gives us the answer. :)
Tools and Scripts for Autodesk 3dsMax
It works!!
Thanks a lot miauu!!
I know how to use it, I have the answer! :)