Activity › Forums › Adobe After Effects Expressions › Bulk convert expressions into keyframes
-
Ben Forder
May 13, 2011 at 3:31 pmactually, it worked!!! Thanks so much! Probably because the layer I’m referring to is always the first layer in the comp, it seems to be selected anyway, and I can target any property in it. I attached the bit of the code i used, and part of what I did with it in case anyone stumbling across this thread finds it useful (the whole thing seemed a bit too long, and none of the comp names I’m using probably make any sense anyway!)
app.beginUndoGroup("PleaseBloodyWork");// dan ebberts wrote this function
function convertToKeyframes(theProperty)
{
if ((theProperty.canSetExpression) && (theProperty.expressionEnabled))
{
theProperty.selected = true;
app.executeCommand(app.findMenuCommandId("Convert Expression to Keyframes"));
theProperty.selected = false;
}
}// Convert the expressions to keyframes on the short dummy footage
var presenterComp = app.project.item(2).layer(1);
var ramPresenterComp = app.project.item(2);
var positionerComp = app.project.item(3).layer(1);
var ramPositionerComp = app.project.item(3);
var anchorTarget = presenterComp.property("anchorPoint");
var scaleTarget = presenterComp.property("scale");
var positionTarget = positionerComp.property("position");
ramPositionerComp.ramPreviewTest("",1.0,"");
convertToKeyframes(positionTarget);
ramPresenterComp.ramPreviewTest("",1.0,"");
convertToKeyframes(anchorTarget);
convertToKeyframes(scaleTarget); -
Ben Forder
May 13, 2011 at 3:48 pmI should add, I couldn’t get the workspace duration to work, it would always just try and ram preview the whole 10 minutes of my comps, so I made two little 3 frame duration comps and used the keyframe converter on them, then just got the script to read the results and copy the values to the same properties of the actual longer footage.
Reply to this Discussion! Login or Sign Up