[3DS MAx] [MAX Plus] Assign Shader from Material Library

Hi there,
I recently develop a tool where I have to assign shader from a MaterialLibrary.

I get the shaders like that:

def get_library_materials(matlib_path):
    materials=[]
    MaxPlus.MaterialEditor.LoadMaterialLibrary(matlib_path)
    matlib=MaxPlus.MaterialLibrary.GetCurrentLibrary()
    for i in range (0,matlib.GetNumMaterials()):
        materials.append(matlib.GetMaterial(i))
        
    return materials

but when assigning one of those shaders, I get an TypeError, because the shaders out of the Library are MtlBase, when picking from the scene they are Mtl. Does anybody know how to get the INode from the MtlBase?

thanks in advance

Flo

Okay found a workaround. I Cast the Mtl from the Base here is some code:

MaxPlus.Mtl._CastFrom(matlib.GetMaterial(i))
1 Like