Put Material to Scene replacement

Since max 2009 (?) the "Put Material to Scene" does not function any more,
but I need this function !! When i merge Objects with identical material names i end up with multiply same named but not instanced materials - even when i click "use scene material" during the import.

It would be nice to have a script that simply select all objects with same material names so i can easily replace these materials...


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
frankiller's picture

Same Problem! please help!

Hello Rockobello,

I have the same problem you`ve had with the duplicate materials although identical in the same scene!

You said you`ve made a script to solve this. I`d be very thankful if you could provide me with it, as I have no idea about scripting. It`ll be of big help.

Thanks in advance.


Anubis's picture

1. If you end with many not

1. If you end with many not instanced materials (with "use scene material" on) that mean they'are not identical.
2. For example, you can have unique scene objects with identical names, but this is not possible for materials. If the mats are not instances and their names are uniques.

my recent MAXScripts RSS (archive here)

rockobello's picture

you are right anubis - in

you are right anubis - in principle.

but i think there is a bug !? try the folllowing:
-create to boxes
-assign two different materials to them
-save the scene
-merge this scene (the two boxes):
duplicate name conflict (auto-rename, apply to all duplicates)
duplicate material conflict (use scene material, apply to all duplicates)

open material editor and have a look at your scene materials: i've got three(!!) materials used in the scene !
there are two absolut identical materials with the same name

Anubis's picture

You said - "assign two

You said - "assign two different materials". I made your test and everything is fine here. They merged with their 2 mats and no name conflict or dups.

P.S. - Ok, I think I got what you mean. The mats in the MEditor are virtual array, so there can be holded unique mats with identical names, but... the Scene materials is "phisical" collection and there cannot exist unique mats with identical names, there is why Max ask you what to do if you try to assign different mats with existing name on the scene.

Here is the same with example:

-- Reset Max (or reset ME slots)
-- Select 1st slot and set the diffuse color to balck
-- Drag the material from slot 1 to 2 (and dont rename it)
-- In the slot 2 set the diffuse color to white
-- (so, they are independent copies with identical names)

-- Make 2 boxes
-- Assign the mat from slot 1 to the $Box01
-- Now try to assign the mat from slot 2 to the $Box02
-- ... the dialog jump to ask you what to do...
-- If choose Replace - the new (white) mat used for both
-- If choose Rename - you and with 2 unique mats

my recent MAXScripts RSS (archive here)

rockobello's picture

i know it sounds unbelievable

i know it sounds unbelievable and a few days ago i would agree that it is not possible to have two active (hot) materials in a max scene with the same name.
but believe me, after the procedure i discribed above (merging the two boxes) i end up with three active (hot, used in scene) materials and two of them have the same name.

max 2011 design.

is there anybody out there who can confirm this ?

crystal3d's picture

i can confirm

load an xref objects and merge their materials only! , there you will have lot same named unique materials. "track's script pack"had "instance material by name". it will look at the active mat editor slow and find identical materilas in the scene. but dont get the latest scriptpack as that script is currently broken today(21.02.2012 )


here, the old working one

MacroScript InstanceMaterials category:"Track" tooltip:"Instance Material by Name" buttonText:"Instance Material by Name" Icon:#("BlurScripts",27) (
    on execute do fileIn "TrackScripts/InstanceMaterialsByName.ms"

MacroScript SaveMaterialToLibrary category:"Track" tooltip:"SaveMaterialToLibrary"(
    local quickmatdir=((GetDir #userScripts) + "/TrackScripts/QuickMat/")
    local NewMatlib
    on execute do (
        if not doesFileExist quickmatdir then makeDir  quickmatdir all:true


        fn savematt matt= (
            SaveTempMaterialLibrary currentMaterialLibrary (quickmatdir + matt.name + ".mat")
            NewMatlib=loadTempMaterialLibrary (quickmatdir + matt.name + ".mat")

            for m in 1 to NewMatlib.count do (deleteItem NewMatlib NewMatlib[1].name)
            append NewMatlib matt
            SaveTempMaterialLibrary NewMatlib (quickmatdir + matt.name + ".mat")

btw, great script pack that is..

rockobello's picture

ok. that was easy - even for

ok. that was easy - even for a maxscript-noob like me. i made it on my own.

thanks for listening :-)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.