I’ve been having a few issues where the scenematerials library value in max gets polluted with old materials that have been replaced or not populated with scene additions (such as when you import an FBX, the scenematerials library doesn’t update). There’s the old trick to invoke an update in the scenemateriasl library by using
But this is quite slow when you’ve got very heavy scenes open.
I’ve got a function which returns all the materials in the scene, this is different from the sceneMaterials library as it doesn’t collect maps that aren’t associated with a material (environment slot) or materials which are applied using other methods (PFlow for instance).
SceneMatsLib = #() for o in objects where o.material != undefined do appendifunique SceneMatsLib o.material
Another way would be to get all the instances of all material classes by doing this… but this would get all the nested materials too, which may be what we want, or possibly not.
theMats = #() for o in material.classes do ( join theMats (for m in (getclassinstances o) where (refs.dependentNodes m).count != 0 collect m) ) theMats
Is there a way to find out if a material is nested within another material using the reference system in max?
Is there any other way to collect the scene-materials as the sceneMaterial Library lists them? Trackview perhaps? Or will this have the same problem as the sceneMaterial library not getting updated?