Page 1 of 1
AnimColor Alpha
Posted: Sun May 27, 2018 9:14 am
by dkwroot
I'm having a problem with the AnimColor class. When I use the GetValue function and perform vector operations with other AnimColor objects and then use the SetValue function, the alpha value doesn't transfer. Is this a bug or am I doing something wrong? I checked and both AnimColor objects have an alpha property and when I create a new AnimeColor object by adding, it also has an alpha. It's just the setvalue function doesn't recognize the alpha.
Re: AnimColor Alpha
Posted: Sun May 27, 2018 6:57 pm
by synthsin75
The LM_ColorVector operators don't seem to handle alpha. So the alpha may need to be done separately.
Code: Select all
local mesh = moho:Mesh()
local col1 = mesh:Shape(0).fMyStyle.fFillCol:GetValue(0)
local col2 = mesh:Shape(0).fMyStyle.fFillCol:GetValue(1)
local col3 = LM.ColorVector:new_local()
col3:Set(col1+col2)
print(col1.a.." "..col2.a.." "..col3.a)
col3.a = col1.a+col2.a
print(col1.a.." "..col2.a.." "..col3.a)
Re: AnimColor Alpha
Posted: Tue May 29, 2018 3:47 am
by dkwroot
This worked, thanks Wes. I wonder if this is a bug or if the colorvector operators are supposed to work like this.
Re: AnimColor Alpha
Posted: Tue May 29, 2018 7:27 am
by synthsin75
dkwroot wrote:This worked, thanks Wes. I wonder if this is a bug or if the colorvector operators are supposed to work like this.
I'm not sure if it was intended to handle alpha or not.
Re: AnimColor Alpha
Posted: Tue May 29, 2018 1:10 pm
by hayasidist
Yeah - I've never seen alpha handled by the operators - I've also found a few other "uh?" moments with color vectors -- there seems to be no limiting on an operation - IOW e.g. white*5 = 5,5,5; white + white = 2,2,2; black - white = -1,-1,-1 -- but that's what Normalise is there for... although that does just limit instead of "scale" (I can see the reason why it does - but I can also see that norm could be e.g. 6,3,2 -> 1, .5, .333 rather than 1,1,1 - and I've never bothered to try to use Mag or SquaredMag in such situations)
Personally, I usually do colour operations "by hand" on each channel
the 4 versions of Set do seem to work as expected tho'