Notifications
Clear all
[Closed] Loading Material to Material Slot from Library
Mar 14, 2014 8:17 pm
I’m trying to load a material from a Library .mat file. No success. Seems like it should be pretty straight forward.
Here’s the error:
– Type error: Material library index must be number or name, got: undefined
Thanks,
-=Chris
–Load Material to Material Slot from Library
loadMaterialLibrary "C:\Users\chris.VHIKITS\Documents\3dsMax\materiallibraries\Test.mat"
setMeditMaterial 1 redTest --redTest is the name of the Material
--MeditMaterials[1] = currentMaterialLibrary ["redTest"] --Tried this also.
5 Replies
Mar 14, 2014 8:17 pm
This should works if your matlib file name is correct and if your matlib contains material named “redTest”
matLib = loadTempMaterialLibrary @"C:\Users\chris.VHIKITS\Documents\3dsMax\materiallibraries\Test.mat"
if matLib != undefined do
(
if (mat = matLib["redTest"]) != undefined do setMeditMaterial 1 mat
)
edit: remove spaces in filename
Mar 14, 2014 8:17 pm
You can simply use fn
fn setMEditMat slot: matName: libFile: =
(
if (matLib = loadTempMaterialLibrary libFile) != undefined do
(
if (mat = matLib[matName]) != undefined do setMeditMaterial slot mat
)
)
libFilename = @"C:\some_folder\some_lib.mat"
setMEditMat slot:5 matName:"testMat" libFile:libFilename
Mar 14, 2014 8:17 pm
Can I load a material (e.g. Wood Pine) from the Autodesk Material Library using Maxscript? If so, how? I am using 3ds Max Design 2014. Thank you