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]
Acoloralso 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 suitablecolorobject [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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement