Help with script

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  09 September 2004
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:

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.
__________________
.
~MvN
~My opinions do not represent those of my employer~


 
  09 September 2004
Originally Posted by leonec: 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")
)
 
  09 September 2004
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
__________________
.
~MvN
~My opinions do not represent those of my employer~


 
  09 September 2004
Originally Posted by leonec: 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.
 
  09 September 2004
uda man. thanks alot..you saved me alot of time and headaches.
__________________
.
~MvN
~My opinions do not represent those of my employer~


 
  01 January 2006
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:58 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.