easy question

hi,
i have an object with a multimaterial ( 2 submaterials, and in each defuse channel is a falloff map) assigned. i just want to check whether the second`s submaterial defuse channel has a falloff map.if this is true, it should run the else condition...But i dont get it to work.

cheers cruzifer

objs = selection as array
count= objs.count
For i = 1 to count do
(

if classof objs[i].material.materialList[2].texmap_diffuse =! falloff ()
then(
print "do this"

)
else(
print "do something else"
)

)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
masquerade's picture

--Not Tested-- It should be

--Not Tested--

It should be something like this:

objs=selection as array

for i in objs do

(

if classof i.material.material[2].texmap_diffuse == falloff then
(
print "hede"
)
else
(
print "hodo"
)

)

But,

this will work if all materials of selected objects are Multimaterials containing VrayMtls on the second slot. Because texmap_diffuse is a variable only for Vray material. If you are going to use other materials you have to foolproof your script or add possible variables of other materials also.

Cruzifer's picture

thanx a bunch, it works. i

thanx a bunch, it works. i know that texmap_diffuse is a vray variable - i did it by purpose ;) but could you please explain what it does exactly? the only thing i dont understand is:
"for i in objs do" - how works "i in objs"?
and what was wrong in my attempt?
thanks anyway!

cheers cruzifer

masquerade's picture

I am not particularly good

I am not particularly good in explaining things, but I'll give it a try.

when you define this variable:

objs=selection as array

it creates an array which name is "objs" and put access informations of all objects in selection range.

For example, if you select three teapots and run this command, it returns something like that:

#($Teapot:Teapot02 @ [0.703583,-28.856720,0.000000], $Teapot:Teapot03 @ [21.703278,-48.355049,0.000000], $Teapot:Teapot01 @ [-33.079620,4.926483,0.000000])

 

when we write "for i in objs", i stands for every single object of the selection.

regarding to the three teapot example, all following will do the same job.

1.

for i in objs do 

(print i.name)

2.

for i in selection do

 (print i.name)

3.

for i = 1 to objs.count do

(print objs[i].name)

4.

print $teapot01.name

print $teapot02.name

print $teapot03.name

 

Cruzifer's picture

thaks alot

thaks alot masquerade,
actually your try of explanation was very good :)
it really helped me out!

have a nice day
cheers cruzifer

masquerade's picture

you are welcome, glad if I

you are welcome, glad if I could help.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.