[Closed] Duplicated materials and XRef files
I would like to create a script to clean up scenes where a lot of texture duplicates occur, however, I need some help to clarify some concepts because I am still a bit confused.
My scene has a lot of xref objects. However, most of them use the same source material library or material diffuse map, so in the end I have, say, 50 xrefs that use the same unique material library and 5 materials.
When I open the material editor, I see the name of these material libraries repeated a lot.
Is there a way to optimize this, by assigning the same texture to several xrefs in order to clean up the slate material editor? or is it the way max works and the material editor will show the material for each xref?
Having all these “duplicated materials” slows down significantly the network (backburner) rendering of the scene
Thanks a lot.
Just wanted to see if you new about this tool?
If that dosent help. you can just write a script to go through the objects in the scene and compare them with the materials and if they share the same material use one of them.
Using something like this.
--add the name of the material your trying to find here
theMaterialName = "Material #25"
for i in selection do
(
--print i.material.name
if i.material.name == theMaterialName then
(
print (i.name + "The material is the same")
)
)
-- this will print the names of any selected objects material
for i in selection do
(
print i.material.name
)
Once you know what to compare we can find them all and make sure they are using the same material.
Thanks a lot Viro,
The first answer did not help, because it helps only with Multi-sub materials. Does not solve the problem with the missing xref entities/materials.
I will go for the script taking your second response as a basis, and will post the results here
Thanks again!