Return-Path: Received: from qmta01.emeryville.ca.mail.comcast.net ([76.96.30.16] verified) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP id 5050238 for ae-list@media-motion.tv; Wed, 24 Apr 2013 21:16:01 +0200 Received: from omta05.emeryville.ca.mail.comcast.net ([76.96.30.43]) by qmta01.emeryville.ca.mail.comcast.net with comcast id Tqo41l0040vp7WLA1vQMWZ; Wed, 24 Apr 2013 19:24:21 +0000 Received: from HPZ200 ([76.20.32.7]) by omta05.emeryville.ca.mail.comcast.net with comcast id TvQL1l00P09DSM08RvQMaX; Wed, 24 Apr 2013 19:24:21 +0000 Message-ID: From: "Dan Ebberts" To: "After Effects Mail List" References: In-Reply-To: Subject: Re: [AE] Converting animated camera Orientation to Rotation? Date: Wed, 24 Apr 2013 12:24:21 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0063_01CE40E6.A657F100" X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 15.4.3555.308 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3555.308 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1366831461; bh=MCZsP416jwmrtWCD48vwEaDGYdkpMW1pz+miHb89p6E=; h=Received:Received:Message-ID:From:To:Subject:Date:MIME-Version: Content-Type; b=C+wwYSkYEsnpGFa9UzN0+7BwQ3oNv5WslMCsYIuE+6LDDzd4tFsN1fy4m53RzNY8/ D+l3pnLQrsHWmQe7+eBIx8oQCLRXgW3Y219STZ7MwsrRiINd/Hte0mTu9qo5mRVNMV Wc/F7UQBuih+RQzoT/rhNGmbHiJAdZscJINyaXmMfx8Pbd5e9MfXTUMh9WlUW+rgBM wGzeDys/hiI/06jM1Nva7HBphPml5jo/C2Khui9wqwTv+0QCke4KFuk+W01oc+UASU GQCbHFLF2kucwH2OmAhf9RYtbEm5QeL/OpXcA3u9YB3IK5NVMMQOeIBIte7Uyjajd1 Te/NaI/3WyapQ== This is a multi-part message in MIME format. ------=_NextPart_000_0063_01CE40E6.A657F100 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Try this: { var myComp =3D app.project.activeItem; if ((myComp !=3D null) && (myComp instanceof CompItem) && = (myComp.selectedLayers.length !=3D 0)){ app.beginUndoGroup("Convert 3D Orientation to Rotation"); var myLayer; var myVal; var t; for (var i =3D 0; i < myComp.selectedLayers.length; i++){ myLayer =3D app.project.activeItem.selectedLayers[i]; myOrientation =3D myLayer.property("Orientation"); if (myOrientation.numKeys > 0){ for (var j =3D 1; j <=3D = myLayer.property("Orientation").numKeys; j++){ myVal =3D = myLayer.property("Orientation").keyValue(j); t =3D 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 =3D 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 From: Robert Kjettrup=20 Sent: Wednesday, April 24, 2013 12:16 PM To: After Effects Mail List=20 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. - Robert 2013/4/24 scott.aelist > Doing any adjustments on a keyframed orientation is really = counterintuitive. Sounds like you want to use an expression rather than a script then? +---End of message---+ To unsubscribe send any message to ------=_NextPart_000_0063_01CE40E6.A657F100 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Try this:
 
{
    var myComp =3D app.project.activeItem;
    if ((myComp !=3D null) && (myComp = instanceof=20 CompItem) && (myComp.selectedLayers.length !=3D 0)){
        = app.beginUndoGroup("Convert 3D=20 Orientation to Rotation");
        var myLayer;
        var myVal;
        var t;
        for (var i =3D 0; i < = myComp.selectedLayers.length; i++){
            = myLayer=20 =3D app.project.activeItem.selectedLayers[i];
           =20 myOrientation =3D myLayer.property("Orientation");
            = if=20 (myOrientation.numKeys > 0){
           &n= bsp;   =20 for (var j =3D 1; j <=3D myLayer.property("Orientation").numKeys; = j++){
           &n= bsp;       =20 myVal =3D myLayer.property("Orientation").keyValue(j);
           &n= bsp;       =20 t =3D myLayer.property("Orientation").keyTime(j);
           &n= bsp;       =20 myLayer.property("xRotation").setValueAtTime(t,myVal[0]);
           &n= bsp;       =20 myLayer.property("yRotation").setValueAtTime(t,myVal[1]);
           &n= bsp;       =20 myLayer.property("zRotation").setValueAtTime(t,myVal[2]);
           &n= bsp;       =20 myLayer.property("orientation").setValueAtKey(j,[0,0,0]);
           &n= bsp;   =20 }
           =20 }else{
           &n= bsp;   =20 myVal =3D myLayer.property("Orientation").value;
           &n= bsp;   =20 myLayer.property("xRotation").setValue(myVal[0]);
           &n= bsp;   =20 myLayer.property("yRotation").setValue(myVal[1]);
           &n= bsp;   =20 myLayer.property("zRotation").setValue(myVal[2]);
           &n= bsp;   =20 myLayer.property("orientation").setValue([0,0,0]);
            = }
        }
        = app.endUndoGroup();
    }else{
        alert("Please select at = least=20 one layer...");
    }
}
 
 
Dan
 
Sent: Wednesday, April 24, 2013 12:16 PM
Subject: Re: [AE] Converting animated camera Orientation to=20 Rotation?
 
No... i just want to manually adjust some of the = keyframes of the=20 rotation, eg. smoothing some areas, but that is really hard to do with = the=20 orientation keyframes when it jumps from 359.9 degrees to 0, making = huuuge=20 visual jumps in the graph editor.
 
- Robert
 
 
2013/4/24 scott.aelist <scott.aelist@gmail.com>
> Doing any adjustments on a keyframed orientation = is really=20 counterintuitive.

Sounds like you want to use an = expression=20 rather than a script then?

+---End of message---+
To = unsubscribe=20 send any message to <ae-list-off@media-motion.tv>
 
------=_NextPart_000_0063_01CE40E6.A657F100--