--This script will save all scene materials to disk as a material library file(named "sceneMats.mat"). -- macroscript sceneMatsToLibByObjectName -- category:"Custom" -- ( if sceneMaterials.count > 0 do ( tempLib = materialLibrary sceneMaterials[1] --construct matLib using any material deleteItem tempLib 1 --clear matLib for obj in objects do ( if obj.material != undefined do ( tempMat = copy obj.Material tempMat.name = obj.name as String + "_mat" append tempLib tempMat )--end if )--end for thePath = getSavePath caption:"Choose folder to save Material Library (\"sceneMats.mat\") to:" initialDir:(getDir #matLib) if thePath != undefined then ( if saveTempMaterialLibrary tempLib (thePath + "\\sceneMats.mat") then ( print (tempLib.count as String + " Materials saved as MatLib to: " + thePath as String + "\\sceneMats.mat") ) else print "Error: Scene Materials could not be saved." ) else print "Saving Scene Materials cancelled by User." )--end if --clean up: tempLib = undefined thePath = undefined tempMat = undefined -- )--end macro