AnimColor Alpha
Moderators: Víctor Paredes, Belgarath, slowtiger
AnimColor Alpha
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.
- synthsin75
- Posts: 9973
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: AnimColor Alpha
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)
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Re: AnimColor Alpha
This worked, thanks Wes. I wonder if this is a bug or if the colorvector operators are supposed to work like this.
- synthsin75
- Posts: 9973
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: AnimColor Alpha
I'm not sure if it was intended to handle alpha or not.dkwroot wrote:This worked, thanks Wes. I wonder if this is a bug or if the colorvector operators are supposed to work like this.
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
- hayasidist
- Posts: 3523
- Joined: Wed Feb 16, 2011 8:12 pm
- Location: Kent, England
Re: AnimColor Alpha
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'
Personally, I usually do colour operations "by hand" on each channel
the 4 versions of Set do seem to work as expected tho'