Skip to main content
Inspiring
December 27, 2013
Question

Can i do Expression to keyframes and smooth via script?

  • December 27, 2013
  • 1 reply
  • 2474 views

hi guys, who know AE scripts can translate expression to linear keyframes via script(now i use app.executeCommand(app.findMenuCommandId("Convert Expression to Keyframes")) ; command) but , for Comman work i must select every time property of layer(opacity, position, scale, etc) where i have expression.... but i need translate very many layers, i always click on property with expression and then do Convert Expression to Keyframes its to long.., can i do something like this

for (var j= 0; j<selectedLayers.length; j++) 

                   {                 

                   var SelLaye= selectedLayers;                  

                   if (SelLayer.transform.opacity.expression!=null && (SelLayer.transform.opacity.expression!=null) && (SelLayer.transform.opacity.expression!=null)) //check if layer have expression

                         {

                         SelLayer.transform.position.select=true;  //and here i need set cursor to position, expression, etc, where i have expression and translate to linear kayframes(but i dont know how)

                         app.executeCommand(app.findMenuCommandId("Convert Expression to Keyframes")) //do translation

                         SelLayer.transform.rotation.select=true;

                         app.executeCommand(app.findMenuCommandId("Convert Expression to Keyframes")) 

                         SelLayer.transform.scale.select=true;

                         app.executeCommand(app.findMenuCommandId("Convert Expression to Keyframes"))

                         //and after this also need do a smoother or something like this for decreasing linear keys for max(because app.executeCommand(app.findMenuCommandId("Convert Expression to Keyframes")) create to many keyframes)

                   }

sorry for bad English

This topic has been closed for replies.

1 reply

Alex White
Legend
December 29, 2013

Sup,

Earlier Dan Ebberts already wrote the answer on CreativeCow:

http://forums.creativecow.net/thread/227/13039#13041

Можно все выбранные значения добавить в массив и потом уже дергать из оттуда, ну либо вручную прописывать в скрипте. Кому как больше нравится.

AE has "Smoother" panel, but as far as I know you can`t access it via scripting using app.executeCommand(app.findMenuCommandId("Smoother")) or something.

But there is a script that makes same work , called Smart Baker. You can download it here:

http://www.creatogether.com/ctg-smart-baker

zipkievAuthor
Inspiring
December 30, 2013

Alex Grey

thx, i tried 2 scripts, and i think its work, later i try compose two scripts in one, but for now i think it's exactly what i need.

zipkievAuthor
Inspiring
January 5, 2014

UPD i find that Smart Baker work only on position property, can it smooth all properties like rotation, position, scale, opacity? some one see other scripts like smart baker? but working with rotation, position, scale, opacity?