# maxscript? consolidate materials with same name into one?

**URL:** <https://forums.chaos.com/t/maxscript-consolidate-materials-with-same-name-into-one/42086>\
**Category:** Off-topic\
**Created:** [July 18, 2012, 7:11am UTC](https://forums.chaos.com/t/maxscript-consolidate-materials-with-same-name-into-one/42086 "2012-07-18T07:11:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Morne](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/morne/32/11335_2.png) [@Morne](https://forums.chaos.com/u/Morne)\
**Post date:** [July 18, 2012, 7:11am UTC](https://forums.chaos.com/t/maxscript-consolidate-materials-with-same-name-into-one/42086/1 "2012-07-18T07:11:21Z")

</div>

Hi all

This is possibly another job for maxscript, unless there is another way?

I have a bunch of materials (some in multisubobject). Some have same names but different material. Some is vray and some is standard. I need to find the 1st vray instance of a material, and then make all the others with same name the same as that one. IE instance the 1st one to the others, so that when I change the one, the rest change… err make sense?

---

<div class="post-metadata">

**Author:** ![Morne](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/morne/32/11335_2.png) [@Morne](https://forums.chaos.com/u/Morne)\
**Post date:** [July 18, 2012, 7:40am UTC](https://forums.chaos.com/t/maxscript-consolidate-materials-with-same-name-into-one/42086/2 "2012-07-18T07:40:13Z")

</div>

🙂  
and it gets more complicated. I want to scan to see which materials with different names are actually the same material, and then consolidate into 1 material

---

<div class="post-metadata">

**Author:** ![dgsantana](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/dgsantana/32/48592_2.png) [@dgsantana](https://forums.chaos.com/u/dgsantana)\
**Post date:** [July 18, 2012, 9:45am UTC](https://forums.chaos.com/t/maxscript-consolidate-materials-with-same-name-into-one/42086/3 "2012-07-18T09:45:23Z")

</div>

Hi Morne,  
I made this script a long time ago it uses heuristics to determine if a material is the same (even with diferent names) a tries to consolidate them.

Best regards,  
Daniel  
[RemoveDuplicateMats.txt](https://forums.chaos.com/uploads/short-url/48JeauD8KDlo8iPListGvIVGhsD.txt) (8.15 KB)

---

<div class="post-metadata">

**Author:** ![Morne](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/morne/32/11335_2.png) [@Morne](https://forums.chaos.com/u/Morne)\
**Post date:** [July 18, 2012, 9:47am UTC](https://forums.chaos.com/t/maxscript-consolidate-materials-with-same-name-into-one/42086/4 "2012-07-18T09:47:20Z")

</div>

Thanks Daniel

How Do I use it?

---

<div class="post-metadata">

**Author:** ![dgsantana](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/dgsantana/32/48592_2.png) [@dgsantana](https://forums.chaos.com/u/dgsantana)\
**Post date:** [July 18, 2012, 9:53am UTC](https://forums.chaos.com/t/maxscript-consolidate-materials-with-same-name-into-one/42086/5 "2012-07-18T09:53:02Z")

</div>

Just run it or drag to the viewport (after changing from txt to ms). I think i removed the dependencies it has on other scripts, so there should be no errors. But if it gives a error just tell me i will try to correct. Also save before using it.

Best regards,  
Daniel
