Transfer Keyframes from specified layer to null
Posted: May 23rd, 2010, 10:04 pm
Ok, I've stared at this long enough over the months trying different setups with no real results. Figured I would ask the collective of gurus here. This is part of a new script I have in the works and I've gotten part of the task to work. This code works properly by taking all the keyframes from a specified layer and copying them over to a NULL.
The issue is that it only copies over the base X/Y data and none of the other data like spacial, temporal, etc.... I'm lost with all of these methods at the moment...
Any help is appreciated.
Code: Select all
app.beginUndoGroup("Transfer Keys");
var mainComp = app.project.activeItem;
var userCam = mainComp.activeCamera;
var camPosProp = userCam.property("Transform").property("Position");
var keys = Array();
for (var i = 1; i <= camPosProp.numKeys; i++)
keys[keys.length] = camPosProp.keyValue(i);
var first = camPosProp.keyTime(1);
var last = camPosProp.keyTime(camPosProp.numKeys);
while(camPosProp.numKeys)
camPosProp.removeKey(1);
var camController = mainComp.layers.addNull();
camController.name = userCam.name;
camController.threeDLayer = true;
camControllerPosKey = camController.property("Transform").property("Position");
for(i = 1; i <= keys.length; i++)
camControllerPosKey.setValueAtTime(first + (last - first) / (keys.length - 1) * (i-1), keys[i-1]); //first + (last - first) / (keys.length - 1) * (i-1)
app.endUndoGroup();
Code: Select all
keyInInterpolationType()
keyOutInterpolationType()
setSpatialTangentsAtKey()
keyInSpatialTangent()
keyOutSpatialTangent()
setTemporalEaseAtKey()
keyInTemporalEase()
keyOutTemporalEase()
setTemporalContinuousAtKey()
keyTemporalContinuous()
setTemporalAutoBezierAtKey()
keyTemporalAutoBezier()
setSpatialContinuousAtKey()
keySpatialContinuous()
setSpatialAutoBezierAtKey()
keySpatialAutoBezier()
setRovingAtKey()
keyRoving()
Any help is appreciated.