Assign a color to a material property (Solved)
c567591a
Posts: 44
How do I assign a color to a material property? In this case I am looking to assign Emission Color.
I have gotten the property found.
var prop2 = mat.findPropertyByLabel( "Emission Color" );
I also can succesfully set the texture.
prop2.setMap( tex );
When I did this for the Bump Map I was able to set the numeric property.
prop2.setDoubleValue(1.0);
I still can't figure out how to read or write to the color of the property.
I have dug through forums, docs, and samples and still havent found the magic.
What is the getter/setter for the color values on the Emission Color property (or other color properties on a material)?
Post edited by c567591a on
Comments
Of course now I find the magic...
I needed to use a intermediate object... though there is probably a way to avoid that.
For others:
var prop2 = mat.findPropertyByLabel( "Emission Color" );
//Get the color
var pColor = prop2.getColorValue();
print ("Emission Value: ", String( "0x%1" ).argInt(pColor.rgb,0,16) );
//Now we set it
pColor.setRgb(0xFFFFFF);
prop2.setColorValue(pColor);