Setting shape colors
Posted: Sat Mar 07, 2009 2:22 am
Experts,
I'm having a few issues with something that I'm probably making much harder than it should be. First of all, for some reason I can't set a key on a shape fill color. Can anyone tell me why this:
shape.fMyStyle.fFillCol:AddKey( self.currentFrame )
gives me an error? (All the other shape operations work fine -- this one says "Argument #2 is nil -- number expected" but I didn't think there were two arguments for this function to AddKey).
Second, and perhaps more importantly, I can change a shape's color by doing this:
shape.fMyStyle.fFillCol:SetValue(0, fColor)
and manipulating the RGB values of fColor to my heart's content. All well and good... UNTIL I set a key on that shape. Now as soon as the shape is keyed I can no longer use that function (well, I don't get an error message, it just doesn't work) on that frame or any other frame.
Actually -- it's even weirder than that. It definitely *seems* to work "behind the scenes". Which is to say the RGB values of the shape fill do change in the local variable structure:
local fColor = shape.fMyStyle.fFillCol:GetValue(0):AsColorStruct()
and are accessible and changeable (I can print them out as I repeatedly call the function) but they are definitely NOT what is coloring the shape (it's very weird, I know). Without a key they are IN the shape and behave as you'd expect -- with a key they can't be altered or even accessed correctly (because what I get are the "old" values).
It's almost as if there are two separate entities, the "normal" color values of that shape and if a key is set a "keyed" set of values (that I have no way of getting at).
Any help will prevent me from losing what's left of my mind.
I'm having a few issues with something that I'm probably making much harder than it should be. First of all, for some reason I can't set a key on a shape fill color. Can anyone tell me why this:
shape.fMyStyle.fFillCol:AddKey( self.currentFrame )
gives me an error? (All the other shape operations work fine -- this one says "Argument #2 is nil -- number expected" but I didn't think there were two arguments for this function to AddKey).
Second, and perhaps more importantly, I can change a shape's color by doing this:
shape.fMyStyle.fFillCol:SetValue(0, fColor)
and manipulating the RGB values of fColor to my heart's content. All well and good... UNTIL I set a key on that shape. Now as soon as the shape is keyed I can no longer use that function (well, I don't get an error message, it just doesn't work) on that frame or any other frame.
Actually -- it's even weirder than that. It definitely *seems* to work "behind the scenes". Which is to say the RGB values of the shape fill do change in the local variable structure:
local fColor = shape.fMyStyle.fFillCol:GetValue(0):AsColorStruct()
and are accessible and changeable (I can print them out as I repeatedly call the function) but they are definitely NOT what is coloring the shape (it's very weird, I know). Without a key they are IN the shape and behave as you'd expect -- with a key they can't be altered or even accessed correctly (because what I get are the "old" values).
It's almost as if there are two separate entities, the "normal" color values of that shape and if a key is set a "keyed" set of values (that I have no way of getting at).
Any help will prevent me from losing what's left of my mind.