Try this:
{
var myComp = app.project.activeItem;
if ((myComp != null) && (myComp instanceof
CompItem) && (myComp.selectedLayers.length != 0)){
app.beginUndoGroup("Convert 3D
Orientation to Rotation");
var myLayer;
var myVal;
var t;
for (var i = 0; i <
myComp.selectedLayers.length; i++){
myLayer
= app.project.activeItem.selectedLayers[i];
myOrientation = myLayer.property("Orientation");
if
(myOrientation.numKeys > 0){
for (var j = 1; j <= myLayer.property("Orientation").numKeys; j++){
myVal = myLayer.property("Orientation").keyValue(j);
t = myLayer.property("Orientation").keyTime(j);
myLayer.property("xRotation").setValueAtTime(t,myVal[0]);
myLayer.property("yRotation").setValueAtTime(t,myVal[1]);
myLayer.property("zRotation").setValueAtTime(t,myVal[2]);
myLayer.property("orientation").setValueAtKey(j,[0,0,0]);
}
}else{
myVal = myLayer.property("Orientation").value;
myLayer.property("xRotation").setValue(myVal[0]);
myLayer.property("yRotation").setValue(myVal[1]);
myLayer.property("zRotation").setValue(myVal[2]);
myLayer.property("orientation").setValue([0,0,0]);
}
}
app.endUndoGroup();
}else{
alert("Please select at least
one layer...");
}
}
Dan
Sent: Wednesday, April 24, 2013 12:16 PM
Subject: Re: [AE] Converting animated camera Orientation to
Rotation?
No... i just want to manually adjust some of the keyframes of the
rotation, eg. smoothing some areas, but that is really hard to do with the
orientation keyframes when it jumps from 359.9 degrees to 0, making huuuge
visual jumps in the graph editor.