I’m trying to query a set driven key keyframe value.
In the attached example, I already know the driver channel, driver value, and driven channel. ( in this case pCube1.tx = 0 & the driven channel is joint1.ty ).
Does anyone know how can I query the driven value of joint1.ty when pCube1.tx = 0 via .mel command?
//im thinking this is what your after
setAttr pCube1.tx 0; //go to the value you want
getAttr joint1.ty; //get the driven value
//or a little cleaner cause we restore things
float $cur = getAttr pCube1.tx; //get the current channel value for pCube1’s translate X
float $value; //this will hold what we want the sdk value
setAttr pCube1.tx 0; //go to the value you want
$value = getAttr joint1.ty; //get the driven value
setAttr pCube1.tx $cur; //restore back to initial
There might be some bugs in the code (no checking for locked attributes, etc), but hope this helps.
>>Does anyone know how can I query the driven value of joint1.ty when pCube1.tx = 0 via .mel command?
I apologize. I should have asked this better.
What I really want to query is the set driven keyframe value. setDrivenKey command seems to only give you the driver and driven object + channels. Is there something like this that will give you the set driven keyframes values?
// To query the available drivers of pCone1.tx:
setDrivenKeyframe -q -dr pCone1.tx;
[QUOTE=tonthebone;14570]Is there something like this that will give you the set driven keyframes values?
// To query the available drivers of pCone1.tx:
setDrivenKeyframe -q -dr pCone1.tx;[/QUOTE]
I think for an animation curve that is animCurveUL (when I made a sdk through the maya ui, this was the type of curve i got) you want to get the animation curve for the set driven key and use the keyTimeValue[#].keyTime attribute of the animation curve. It gives the keyframe value. You can find that curve using a few ways I think opening the hypergraph:hierarchy window, selecting your driven node, and then showing input connections is a possible way.
//for your example if joint1_translateY is the appropriate animation curve of type animCurveUL
//to get how many set driven keyframes
int $n = size( getAttr joint1_translateY.keyTimeValue[0] );
//then to get the first keyframe
getAttr joint1_translateY.keyTimeValue[0].keyTime;
//to get the second keyframe
getAttr joint1_translateY.keyTimeValue[1].keyTime;
//to get the last keyframe
getAttr joint1_translateY.keyTimeValue[($n-1)].keyTime;
There might be bugs, and I may be wrong and the keyframe command works with these types of curves too.
I know this thread is old, but for anyone else on google who finds this post: remember to use the “scn” flag to skip conversion nodes when finding the driven channels using listConnections. Otherwise it will still not work for rotation values, as you will just run into the unitconversions