scenematerials force update?


Hi, I just noticed that the scenematerials variable is not updating when a new material has been put on an object (the old material should be deleted if it is not used on another object), instead it waits a certain amount of time before it deletes the materials that are not used in the scene anymore.
You can see what I mean in this short video:

Is there a way to mannualy force an update on the scene materials with mxs?


Try this for checking

 for i in scenematerials where refs.dependentNodes i firstOnly:on != undefined do print i


Thank you, I spent the last 1.5h trying to find out what was wrong, and you fixed it in no time :slight_smile:


I did not test this

for i in 1 to scenematerials.count where refs.dependentNodes scenematerials[i] firstOnly:on == undefined do deleteitem rootscene[#Scene_Materials].object i


check this thread:
and this:


Thanks Denis,
I noticed looking in trackView that after autosave scene unused matrials disappear ei. scene materials lib is updated. Your code do the same


I also noticed that if you open material editor and use the button Assign Material To Selection (you can assign any material to any object) the scenematerials variable gets cleaned up, and shows just the materials in the scene as is should.


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.