detecting class

Currently i'm editing my first major script project i've undertaken and while adding new features i've come across a bit that's stumped me.

what i want to do is perform an operation on a standard material or a vray material (copy a map) to a seperate material entirely. but i want it to detect which of the 2 types it is so i can use the correct term ie diffusemap or texmap_diffuse

so for example i have a material defined in the script to create called

"test"

so i've got

abc = meditmaterials[1]

if getnumsubmtls meditmaterials[1] == 0 do
(
test.diffusemap = copy abc.texmap_diffuse
)

now this works fine for a vray material but if the material in question is a standard material the texmap_diffuse would need to be diffusemap

how can i identify before hand whether the slot is standard material or vray material and then use the correct term?
i feel this is something very simple and i've just got a mindblock but any help is appreciated

thank you for your help guys

Comments

Comment viewing options

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

Thanks for that Graph. i kept

Thanks for that Graph. i kept getting errors when i was using the above method but I used the following after a bit of digging:

case of
(
(classOf meditmaterials[1]==standardmaterial):
(stuff)

(classOf meditmaterials[1]==vraymtl):
(otherstuff)
)

:) thanks again

Graph's picture

case (classOf

case (classOf  meditmaterials[1])
(
  standardMaterial : 
  (
    do stuff()
  )
 
  otherClass : 
  (
    do other stuff()
  )
)

Raphael 'Insanto' Steves
http://Graph.Net84.Net

Comment viewing options

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