Activity › Forums › Adobe After Effects Expressions › Changing keyframes of a layer in multiple Comps
-
Changing keyframes of a layer in multiple Comps
Posted by David Rock on May 30, 2022 at 2:23 pmI have a null controlling a profile pic (scale up) and after using this in around 300 comps just realised the scale up is a bit too much. Don’t want to go into ALL those comps and change manually….any scripts or suggestions?
David Rock replied 4 years, 3 months ago 2 Members · 2 Replies -
2 Replies
-
Filip Vandueren
May 30, 2022 at 4:06 pmThat would need a (possibly simple), but bespoke script.
It depends on how easily you can programmatically determine the keyframe to change.For example is it always the 2nd keyframe ?, Does the Null always have the same name, or does it always use the same ‘Solid’ as a source (which would happen if you ahve always copy pasted or duplicated it)
If it’s more a case of a human can see at a glance which keyframe it would be in the project, but a stupid computer can’t using simple rules, then it’s not possible with scripting.
-
David Rock
May 30, 2022 at 7:06 pmThanks for your reply…got a solution from Dan Ebberts, saved me a whole bunch of time.
The Null was called Pic Contoller. It has 3 keyframes, wanted to change the second one from 123% to 98%
function fixScale(){
var myComp;
var myLayer;
var myProp;
for (var i = 1; i <= app.project.numItems; i++){
if (app.project.item(i) instanceof CompItem){
myComp = app.project.item(i);
for (var j= 1; j <= myComp.numLayers; j++){
myLayer = myComp.layer(j);
if (myLayer.name == “Pic Controller”){
myProp = myLayer.property(“Scale”);
if (myProp.numKeys > 1){
myProp.setValueAtKey(2,[98,98]);
}
break;
}
}
}
}
}
fixScale();
Reply to this Discussion! Login or Sign Up