Notifications
Clear all

[Closed] 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: https://docs.google.com/file/d/0B0V4AxfEEBovcjNCaVRGOHc5UUU/edit?usp=sharing

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

6 Replies
2 Replies
(@gazybara)
Joined: 11 months ago

Posts: 0

Try this for checking


 for i in scenematerials where refs.dependentNodes i firstOnly:on != undefined do print i
 
(@zarko)
Joined: 11 months ago

Posts: 0

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

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
1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

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.