View Full Version : Materials in arrays
09-22-2006, 10:56 PM
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.
09-23-2006, 12:01 AM
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:
append matsArray (copy mEditMaterials)
Hope that helps.
09-25-2006, 07:18 PM
Great... Worked just fine...
Thanks a lot... =)
And now... Well, I need to know which texturemaps the material has... If I do mEditMaterials.maps (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)
09-25-2006, 09:27 PM
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:
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"
09-25-2006, 10:28 PM
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?
09-25-2006, 10:28 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.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.