-- XRef Material Library from .max (XRefMatLib) -- (c) 2018 Michele Poletto (micke.plt@gmail.com) -- Verison History: -- v0.10 (2018/12/23) Initial Idea -- This script create a .mat file which contains XRef Materials of all materials included in your current scene. -- This provides you to set your current scene as the parent material scene (PMS) -- Every time you modify a material in this scene the XRef Material assigned to an object in another scene will be updated. -- If you have updated the PMS and you have opened at the same time a scene where you have applied an XRef Material you must update XRef Material form XRef Object Windows to see the update. (File - Reference - XRef Object). -- get current file name and file path thefile= maxfilepath+maxfilename thepath= maxfilepath -- get only file name without ".max" onlythename=getFilenameFile maxfilename -- save max saveMaxFile thefile -- reset max resetMaxFile #noPrompt -- import paretn scene as XRef Object Xrefobjs = getMAXFileObjectNames thefile xrefs.addNewXRefObject thefile Xrefobjs -- setup the material library name theLibraryName=(onlythename+".mat") -- action!!! ( -- define the material library newLib = materialLibrary() -- add all xref material at the material library for m in sceneMaterials where classof m == XRef_Material do ( append newLib m -- can I sort material by name? ) -- save material library at the same position of your PMS saveTempMaterialLibrary newLib (thepath+theLibraryName) ) -- reset max resetMaxFile #noPrompt -- reload PMS loadMaxFile thefile