[Closed] Help with script
I have this script that assigns a basic material with a empty bitmap assigned to the diffuse slot. And it gives the material the same name as the object. Here it is:
[color=darkorange]for[/color] obj in geometry do
(
local mat = standard name:obj.name
obj.material = mat
obj.material.diffusemap = bitmaptexture filename:“E:\3dsmax6\Images\obj.name.jpg”
)
What I would like to do now is automate the bitmap assignment. so that if the bitmap name was the same as the obj name then is there a way to tell this script to grab the bitmap with the same name as the object and load it?
I hope I explained myself right.
Just a small change:
for obj in geometry do
(
local mat = standard name:obj.name
obj.material = mat
obj.material.diffusemap = bitmaptexture filename:(“E:\3dsmax6\Images”+obj.name+”.jpg”)
)
Thanks for all your help Bobo…again.
I am getting this error when I evaluate.
– Syntax error: at bad, expected <keyword arg>
– In line: obj.material.diffusemap = bitmaptexture filename:(“E:\3dsmax6\images”+obj.name+”.jpg”)
[color=white]
Do you know what it means? because I sure don’t.
Thanks again[/color]
Ah, your error, my bad
for obj in geometry do
(
local mat = standard name:obj.name
obj.material = mat
obj.material.diffusemap = bitmaptexture filename:(“E:\3dsmax6\Images\”+obj.name+”.jpg”)
)
or
for obj in geometry do
(
local mat = standard name:obj.name
obj.material = mat
obj.material.diffusemap = bitmaptexture filename:(“E:/3dsmax6/Images/”+obj.name+”.jpg”)
)
because ” means “use the quote inside the string”, so it did not close the string correctly.
ALWAYS use double-backslashes inside of script code or just single slashes.