PDA

View Full Version : Is tere a way to check if a material already exists in the m editor?


Billibong
11-25-2005, 07:56 PM
Hi,

I'd like to not have to re-create a multi-sub material if it already exists by name in the material editor. Is there a quick way to check if a material name is already existing in one of the slots, and if it is set that material to current.


Thanks,
Billibong

magicm
11-25-2005, 08:09 PM
Hi Bill,

Here's a quick example:

(

-- create two materials with identical names
mat1 = standardmaterial name:"Testing"
mat2 = standardmaterial name:"Testing"

-- put first material in material editor slot 1
meditmaterials[1] = mat1

-- mat1 is stored in the material editor
if meditmaterials["Testing"] == mat1 then
format "Material \"mat1\" found in Material Editor.\n"

-- mat2 is NOT stored in the material editor
if meditmaterials["Testing"] == mat2 then
format "Material \"mat2\" found in Material Editor.\n"

)

Cheers,
Martijn

CGTalk Moderation
11-25-2005, 08:09 PM
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.