Assigning a bitmap to a standard material


#1

I want to assign a jpg to a standard material by maxscript

This is the script I have:

for i = 1 to 11 do (
meditMaterials[i].diffuseMap.filename = “C:\Users\admin\Desktop\Max Libraries\Textures\Buildings\Industrial\I”+i as string + “\Walls.jpg”
)

And this is the response I get:

– Error occurred in anonymous codeblock; filename: ; position: 212; line: 4
– Unknown property: “filename” in undefined
– MAXScript callstack:
– thread data: threadID:5304


– [stack level: 0]
– In i loop; filename: ; position: 211; line: 3
– Parameters:
– i: 1
– Locals:
– i: 1
– Externals:
– owner: undefined


– [stack level: 1]
– called from top-level

I would love some help on this topic

Thank you


#2

You should first check whether meditMaterials[i].diffuseMap is undefined or not.

if isproperty Mat #diffusemap and Mat.diffusemap != undefined do ...


#3

Thank you that helped very much