CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 09-22-2006, 09:56 PM   #1
Celarien
Appreciator
Peter
Programmer
Rio de Janeiro, Brazil
 
Join Date: Sep 2006
Posts: 51
Send a message via ICQ to Celarien Send a message via MSN to Celarien
Materials in arrays

Is it possible to create an array containing materials, but without them being just references (or instances) of the main material?

I have an array of say 5 elements, and each of these elements is a copy of a base material with one it's texturemaps properties altered, to differ slightly one from the other.

Is that possible? I've tried, but what I got was the base material's texturemap property was changed, changing all the other ones also, as if they were instances or references...

I hope that explantion is clear, thanks in advance.
 
Old 09-22-2006, 11:01 PM   #2
HalfVector
H = E + L
Jonathan Garcia
Cartagena, España
 
Join Date: Dec 2005
Posts: 216
That's happening because you are referencing the material and not copying. To append the copy of a material to an array just do something like this:

Code:
append matsArray (copy mEditMaterials[1])


Hope that helps.
 
Old 09-25-2006, 06:18 PM   #3
Celarien
Appreciator
Peter
Programmer
Rio de Janeiro, Brazil
 
Join Date: Sep 2006
Posts: 51
Send a message via ICQ to Celarien Send a message via MSN to Celarien
Great... Worked just fine...
Thanks a lot... =)

And now... Well, I need to know which texturemaps the material has... If I do mEditMaterials[1].maps[1] (or any other number) it gives me "undefined", thus I'm using the alias (.bumpMap), for example... Is there any way I can find the name without using the alias? (Example, identify via the .maps[] which is which and apply the modification I need to the correct property, without using alias)
 
Old 09-25-2006, 08:27 PM   #4
HalfVector
H = E + L
Jonathan Garcia
Cartagena, España
 
Join Date: Dec 2005
Posts: 216
You can get the map using its index. Just as you've said, using the maps array.

An for the maps names, this function returns the name for each map ID:

Code:
fn getMapIDName matID = ( case matID of ( 1: return "Ambient Color" 2: return "Diffuse Color" 3: return "Specular Color" 4: return "Specular Level" 5: return "Glossiness" 6: return "Self-Illumination" 7: return "Opacity" 8: return "Filter Color" 9: return "Bump" 10: return "Reflection" 11: return "Refraction" 12: return "Displacement" default: return "Unknown" ) )
 
Old 09-25-2006, 09:28 PM   #5
Celarien
Appreciator
Peter
Programmer
Rio de Janeiro, Brazil
 
Join Date: Sep 2006
Posts: 51
Send a message via ICQ to Celarien Send a message via MSN to Celarien
But that's for standard material... If, for example, I create a VRay... It'll tell me I'm treating "bump" while it's some other texturemap... Right?

Thanks
 
Old 09-25-2006, 09:28 PM   #6
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
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 08:50 AM.


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