Access Opacity
-
I have a component that has a color associated with it. when I have it selected and open "Entity Info" on it then click on the color, a "Choose Paint" panel opens and I can edit the Opacity (set it between 0 and 100). I want to access this value in ruby. I can get the colors for example: "ent.material.color.red". But "ent.material.color.alpha" always returns 1 and not the color of the opacity. Clearly it is stored somewhere but I do I get this opacity value?
Thanks in advance,
Dave -
Use
entity.material.alpha
to get it, and e.g.
entity.material.alpha=0.5
to set it [it's from 0.0 to 1.0 - transparent to opaque]
Acolor
also has two equivalent alpha methods [a color has [R,G,B,A]] BUT it doesn't change what is displayed for a material, no matter what the color's alpha is set to be. The color.alpha is 0 to 255 NOT 0.0 to 1.0
From v8+ a color's alpha does affect it's transparency when it's used to color a face made in a method like 'view.draw(GL_POLYGON, coplanar_points_array)
', where you have previously made a suitablecolor
object [with alpha for transparency if desired] and then set it usingview.drawing_color=color
[in previous SUp versions such faces always came out as black' whatever color had been assigned - now it's fixed]... -
Thanks - works perfectly.
Advertisement