Page 1 of 1

Set keyframe at current time for highlighted property?

Posted: November 6th, 2014, 11:04 am
by rawenek
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

Re: Set keyframe at current time for highlighted property?

Posted: November 6th, 2014, 3:05 pm
by Dan Ebberts
Something like this should work:

Code: Select all

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