Page 1 of 1

AnimVec2

Posted: Sat Sep 22, 2007 11:59 pm
by Genete
I'm trying to create a local variable of an AnimVec2 type. That 's a class of the MOHO interface.
Calling this code:

Code: Select all

animvec = MOHO.AnimVec2:new_local()
Gives me this message:

Code: Select all

attempt to call method 'new_local' (a nil value)
What I doing wrong? It is supposed that is not enabled a constructor to the class AnimVec2? If the constructor exists, how can I call it?

I'm trying to store the complete animation channel of a point to recover the animation channel later and overwrite any intermediate modification. This could be an improvement on "freeze points" script.

Thanks for your time.
-G

Posted: Sun Sep 23, 2007 5:17 am
by heyvern
I think there is some confusion in the terminology. "AnimVec2" has nothing to do with "vectors" in a vector layer. It is a type of container for storing a single pair X and Y values.

This had me completely confused when I first started trying to write scripts.

This is how I do it if I understand what you are trying to do:

Code: Select all

                myVariable = LM.Vector2:new_local()
                myVariable = skel:Bone(4).fPos
You only would use this type of variable to store Vector2 values that contain an X and Y value. Like bone position (fPos) or point position.

I don't think there is a way to store the "entire" animation of a point in a single value. You would have to store individual frame channel values in some kind of table and read it back in one frame at a time. You could check each frame for a key, then store the frame and the position of each point.

I am not positive about any of this but I am... pretty sure. I would hate to give misleading information. ;)

-vern