Hi, guys,
I’ve been trying to achieve something in Maya and I’m having a hard time getting the right setup for it. So what I have is the spine of a character: some joints constrained to a curve (using motion paths). So far, so good. Next step is adding volume preservation to the spine, which is not hard: take the original length of the spine curve, divide it by the current length after squashing/stretching and using that value to drive the scaleY and scaleZ attributes on each joint. Using a multiplication factor, independent on each joint, I can add some variation to the scale so I have, for example, a belly that scales a bit more than the chest.
What I’m trying to do is to read these multiplication factors from an animCurve that I have set up in another object. First step is trying to read the keyframe value information, which is possible by using these lines:
getAttr myCurve.keyTimeValue[0].keyValue;
… which returns the value for the first keyframe (I have a animCurve with 3 keyframes that follows the shape of a Gauss bell curve (http://www.itl.nist.gov/div898/handbook/pmc/section5/gifs/normal.gif)). I tried to expose those attributes in the connection editor, but apparently the only way to access them is by scripting. So I went to the Expression Editor, and although everything seems to work in terms of syntax, by using this expression:
baseObject.scaleY = myCurve.keyTimeValue[0].keyValue;
… the value of scaleY is always 0, when the value returned in the first line I quoted is different than 0.
And then, eventually, I might need to get the animCurve value not only in the keyframes, but that will come later. So do you know if I’m missing something here? Is this the way it should be done? Do you happen to know another way?
Thanks!!!