Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4171

rs.ObjectColor() always returns A (transparency) value as 255

$
0
0

I believe I reported this a long, long time ago, but rs.ObjectColor() still always returns 255 (fully opaque) for the A value of a color, even if it is not…

Run the following scriptlet on an object that has some transparency value applied to its display color:

import rhinoscriptsyntax as rs

obj_id=rs.GetObject("Select object to analyze",preselect=True)
if obj_id:
    color=rs.ObjectColor(obj_id)
    print "R={} G={} B={} A={}".format(color.R,color.G,color.B,color.A)

A will always come up as 255.
This is the case with both V7 and the current WIP…

And this despite that the rhinoobject attributes does report the correct A values:

Below for reference is a file with 4 surfaces with differing degrees of transparence. They all come up with the same values using the script.
4xTransp.3dm (2.0 MB)

Edit:
Happy to see that at least rs.LayerColor() does report the correct A value.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4171

Latest Images

Trending Articles



Latest Images