Object.getParameter() couldn't find parameter
Hi,
I'm parsing through a list of materials, some of which may have a colour texture assigned and some of which may not (for example marble materials don't have this parameter). I'm using getParameter, but get this error for the marble material...
Object.getParameter() couldn't find parameter called colorTex
Code...
for (i = 0 ; i < doc.materialCount() ; i++)
{
var CheetahMaterial = doc.materialAtIndex(i);
var ColourTexture = CheetahMaterial.getParameter("colorTex");
[snip]
}
How do I determine if a parameter is present before using getParameter? Is it possible to determine the material type, so I can add conditional code? Doing a .rib() on the material reveals 'Surface "Material" "name" "Material" etc', but as Surface isn't in quotes I can't get that using getParameter. I'm new to JavaScript / Cheetah Script, so hopefully there is a way.
Thanks
PS. I know its possible to use colorMap() to get the texture name, but I will also be using this type of code to access other parameters for which there is no direct call.
Hi,
I'm parsing through a list of materials, some of which may have a colour texture assigned and some of which may not (for example marble materials don't have this parameter). I'm using getParameter, but get this error for the marble material...
Object.getParameter() couldn't find parameter called colorTex
Code...
for (i = 0 ; i < doc.materialCount() ; i++)
{
var CheetahMaterial = doc.materialAtIndex(i);
var ColourTexture = CheetahMaterial.getParameter("colorTex");
[snip]
}
How do I determine if a parameter is present before using getParameter? Is it possible to determine the material type, so I can add conditional code? Doing a .rib() on the material reveals 'Surface "Material" "name" "Material" etc', but as Surface isn't in quotes I can't get that using getParameter. I'm new to JavaScript / Cheetah Script, so hopefully there is a way.
Thanks
PS. I know its possible to use colorMap() to get the texture name, but I will also be using this type of code to access other parameters for which there is no direct call.
Last edited: