Expressions/Scripts/Presets

Moderator: byronnash

 
rawenek
Topic Author
Posts: 1
Joined: Thu Nov 06, 2014 4:45 am

Set keyframe at current time for highlighted property?

Thu Nov 06, 2014 11:04 am

Hello,

i was wondering if its possible to create a script or something that when executed would set a keyframe at the current time for the currently selected/highlighted property (selected in timeline or in effects controls)

Obviously the idea is to then hotkey that script and be able to quickly set keyframes for any property without having to always mouseclick the keyframe button or fake value change to trigger autokey whenever dealing with keyframing properties that dont have inbuilt hotkeys for it like pos/rot/scale/opacity do.

Unless iam missing something (i went thru the hotkey config file and couldnt find anything relevant), this would greatly speed up any more complex keyframing, cant believe its not already part of ae by now
 
Dan Ebberts
Posts: 318
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: Set keyframe at current time for highlighted property?

Thu Nov 06, 2014 3:05 pm

Something like this should work:

var myComp = app.project.activeItem;
if (myComp && (myComp instanceof CompItem)){
   var myProps = myComp.selectedProperties;
   if (myProps.length > 0){
      for (var i = 0; i < myProps.length; i++){
         if (myProps[i].canVaryOverTime){
            myProps[i].addKey(myComp.time);
         }
      }
   }else{
      alert("No selected properties.");
   }
}else{
   alert ("No comp selected.");
}



Dan

Who is online

Users browsing this forum: No registered users and 4 guests