PDA

View Full Version : Help with script


Maven
09-27-2004, 08:48 PM
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:

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"
)

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.

Bobo
09-27-2004, 10:44 PM
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:

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")
)

Maven
09-28-2004, 02:26 PM
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")

Do you know what it means? because I sure don't.

Thanks again

Bobo
09-28-2004, 04:26 PM
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")

Do you know what it means? because I sure don't.

Thanks again
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.

Maven
09-28-2004, 05:21 PM
uda man. thanks alot..you saved me alot of time and headaches.:thumbsup:

CGTalk Moderation
01-19-2006, 09:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.