Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
Hi! It is possible to use findKeyframe to find the previous key on a curve by doing something like this:
cmds.findKeyframe("pSphere1", at = "translateX", time = (26, 26), which = "previous")
This will also work on a curve in an animation layer, provided the animation layer is the active layer. However I need a way to use the command on an animation layer curve without first changing to that layer. I discovered from selecting a key that the naming of such a curve is "pSphere1_translateX_AnimLayer1_inputB" and so thought I would be able to do this:
cmds.findKeyframe("pSphere1", at = "pSphere1_translateX_AnimLayer1_inputB", time = (26, 26), which = "previous")
However this doesn't work. The command can't find the curve. I have also tried "translateX_AnimLayer1_inputB", but that doesn't work either.
Does anyone know how to do this?
Solved! Go to Solution.
Solved by Kahylan. Go to Solution.
Hi!
When you want to get this information from a not active animation layer, you have to treat the mixer node assosiated with the layer as the node. Also it is worth mentioning that on rotation channels the attributes will be called "inputBX", "inputBY" and "inputBZ" as the rotation is stored on a different kind of node than translation and scale, just to already adress potential future problems.
So in your example that would be:
cmds.findKeyframe("pSphere1_translateX_AnimLayer1", at = "inputB", time = (26, 26), which = "previous")
I hope it helps!
Amazing! Thank you soooo much! I have been tearing my hair out over this!
I'm not sure if there is a better way to do this since I don't have too much experience when it comes to anim layers.
But from what I see, the way that anim layers link together is that each attribute has a mixer node (exact type "animBlendNodeAdditiveDL") which has the attributes inputA and inputB on it, inputA is connected to the output from mixer node from the anim layer below unless it is the first custom anim layer in which case it is simply connected to the base animation curve and inputB is connected to the Animation Curve added by the anim layer.
So if you want to get the information on the Baselayer, you actually just need to readout the attribute inputA from the mixer node of the first animlayer like so:
cmds.findKeyframe("pSphere1_translateX_AnimLayer1", at = "inputA", time = (26, 26), which = "previous")
Something you'll need to be careful about is that this will cause Errors if you run this on any mixer node from another layer, because the findKeyframe command only works if there is an AnimationCurve connected to the Attribute but not with a mixer node. So you should probably add in an objectType query before the findKeyframe command to make sure you are acctually accessing an animated attribute.
Can't find what you're looking for? Ask the community or share your knowledge.