-
Script for Standard Pose
Hello Cows,
I am about to animate short scenes with an IK-character in After Effects. All scenes begin and end in the same standard pose.
I would like to create a script that basically resets my character-rig back to the standard pose, so I can easily blend from one clip to another.So far I have a script which reads the value from frame 0 and creates a key at the current time with this value, essentially resetting to the standard value. But it only works for the transform parameters position, rotation and scale.
Some of the layers, like the mouth layer, are animated over a slider control. But not all the layers have 1 or 2 effects on them.
Is it possible to access the effects similarly to the way one accesses the transform options? Is there something similar to “numKeys” like “numEffects”?
Below is what I have so far. Thanks for your help!
{
var myProj = app.project;
var myComp = myProj.activeItem;
var mySelectedLayers = myComp.selectedLayers;app.beginUndoGroup("Standard Pose Keys");
for (var i = 0; i < mySelectedLayers.length; i++) {
var curLayer = mySelectedLayers[i];
var curTime = app.project.activeItem.time;
var oldPosValue = curLayer.property("Position").valueAtTime(0, false);
var oldScaValue = curLayer.property("Scale").valueAtTime(0, false);
var oldRotValue = curLayer.property("Rotation").valueAtTime(0, false);if (curLayer.position.numKeys > 0){
curLayer.position.setValueAtTime(curTime,oldPosValue);
}
if (curLayer.scale.numKeys > 0){
curLayer.scale.setValueAtTime(curTime,oldScaValue);
}
if (curLayer.rotation.numKeys > 0){
curLayer.rotation.setValueAtTime(curTime,oldRotValue);
}}
app.endUndoGroup();
}