Transfer Keyframes from specified layer to null

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
User avatar
vfxman
Posts: 49
Joined: February 23rd, 2007, 7:00 pm
Location: California
Contact:

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.

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();
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...

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.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

I haven't tried doing it myself yet, but if I did I'd be studying Jeff Almasol's Scooter script:
http://www.redefinery.com/ae/view.php?item=rd_Scooter
User avatar
vfxman
Posts: 49
Joined: February 23rd, 2007, 7:00 pm
Location: California
Contact:

Thanks Paul, I will look into that one and see if it helps.
Post Reply