ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

convert a 3d layer's orientation to rotation

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nathan Clark
convert a 3d layer's orientation to rotation
on May 25, 2009 at 10:56:52 am

Is there a method / script / easy way to convert a 3d layer's orientation values to rotation values?
I am working in a medium sized 3d project and would love to avoid doing it manually for the hundreds of layers I am working with.
I searched through all the scripting channels I know of to no avail :(
Any assistance with this would be greatly appreciated!

Thanks cow

-Nathan.

On Point Cloud Nine


Return to posts index

Dan Ebberts
Re: convert a 3d layer's orientation to rotation
on May 25, 2009 at 2:54:17 pm

Like this?

{
var myLayer = app.project.activeItem.selectedLayers[0];
var temp = myLayer.property("orientation").value;
myLayer.property("xRotation").setValue(temp[0]);
myLayer.property("yRotation").setValue(temp[1]);
myLayer.property("zRotation").setValue(temp[2]);
myLayer.property("orientation").setValue([0,0,0]);
}

Dan



Return to posts index

Nathan Clark
Re: convert a 3d layer's orientation to rotation
on May 25, 2009 at 3:28:08 pm

Dan,

You are the man!!

That's twice you've saved me now,

I owe you big time!

Do you have a donations system through motionscript you could refer me to?

I think all your hard work and support to the community deserves some repayment!

By the way,

Would it be WAY harder to include in the script a way to undo the entire operation rather than having to undo multiple times to get back where I started?

Thanks so very much

--Nathan


On Point Cloud Nine


Return to posts index


Nathan Clark
Got It! (+launchpad)
on May 25, 2009 at 4:19:59 pm

Checked Scripting section of motionscript and worked it out...

Thankyou so much!!

hmm scripting looks fun!!

I love the scripts that I have so much in fact that I customized the launch pad to accommodate them!





On Point Cloud Nine


Return to posts index

Nathan Clark
New Problem... ahh
on May 27, 2009 at 5:59:38 am

Okay so what if the layer has rotation and orientation values set, and i need to convert it to just rotation values...

Need a script that looks at a 3d layers rotation and orientation values and bakes them into rotation values only.

Perhaps to make it usefull to a broader range of applications there could be a choice between baking to Rotation or baking to Orientation.

Anybodies help with this would be spectacular!


On Point Cloud Nine


Return to posts index

Dan Ebberts
Re: New Problem... ahh
on May 27, 2009 at 8:21:04 am

Just off the top of my head, I think that's going to be a lot more work. There's probably a way to do that entireley within the script using rotation transforms, but it might be easier to create a new temporary 3D layer, apply an orientation expression to it that captures the world orientation of the target layer (see recent thread on that topic), harvest that orientation value, and convert that to rotation (as before), then delete the temporary layer. Something like that.


Dan



Return to posts index


Nathan Clark
Just one more little thing... :)
on May 29, 2009 at 2:48:01 am

Hey Dan
Your workaround is great, thanks!

It seems though, that the below script will only run on the topmost selected layer, not all of them, is there a tweak we could make so as to ensure the script applies to all selected layers?

{
var myLayer = app.project.activeItem.selectedLayers[0];
var temp = myLayer.property("orientation").value;
myLayer.property("xRotation").setValue(temp[0]);
myLayer.property("yRotation").setValue(temp[1]);
myLayer.property("zRotation").setValue(temp[2]);
myLayer.property("orientation").setValue([0,0,0]);
}


Thanks heaps,

Nathan

On Point Cloud Nine


Return to posts index

Dan Ebberts
Re: Just one more little thing... :)
on May 29, 2009 at 3:03:38 am

Fairly easy:

{
var myLayer;
var temp;
for (var i = 0; i < app.project.activeItem.selectedLayers.length; i++){
myLayer = app.project.activeItem.selectedLayers[i];
var temp = myLayer.property("orientation").value;
myLayer.property("xRotation").setValue(temp[0]);
myLayer.property("yRotation").setValue(temp[1]);
myLayer.property("zRotation").setValue(temp[2]);
myLayer.property("orientation").setValue([0,0,0]);
}
}

Dan



Return to posts index

M. Frank Emanuel
Orientation to Rotation
on Jun 15, 2009 at 4:30:11 am

So, I've been searching and searching for a script that will convert a camera or 3D layer's orientation and rotation to just rotation (zeroing out the orientation. In skewed camera views this is definitely not just a simple addition or subtraction of x,y and z values. Does anyone have a script that can pull this off?


Return to posts index


Nathan Clark
ATTN: Scripting genious' ... [Re: Orientation to Rotation]
on Jun 15, 2009 at 10:20:29 am

Still trying to find one / work one out (but i am very new to scripting)

Dan's method may not do all the work for you, but at least it works. It is a slow workaround when you have a LOT OF LAYERS though.

Its nice to see at least one other person looking for the same script.

Perhaps a scripting genius will consider tackling this one now??



On Point Cloud Nine


Return to posts index

Johnnie Travis
Re: Just one more little thing... :)
on Aug 3, 2011 at 4:09:42 pm

Dan, I am very "green" when it comes to scripting and have a quick question regarding this script: I want to convert a camera's orientation data to rotation data, so, would I apply this script to the camera's rotation data? Any help you could give me would be greatly appreciated. Thanks Dan!

MAC PRO 3.2GHz Quad-Core
16GB RAM
CALDIGIT S2VRHD
AJA KONA LHe
FCP 7.0.2
OSX 10.6.4


Return to posts index

Dan Ebberts
Re: Just one more little thing... :)
on Aug 3, 2011 at 4:39:02 pm

No, you would save it as a .jsx file, select your layer and then File > Scripts > Run Script File... (and navigate to the script file).

Dan



Return to posts index


M. Frank Emanuel
Re: New Problem... ahh
on Jun 15, 2009 at 5:58:29 pm

Does anyone know where said orientation harvesting script lives? I'd try Dan's method because my method of trying to eye match 2 cameras to the exact same rotation (one using rotation and orientation, the other using only rotation) is very time consuming.


Return to posts index

Steve Kirby
Re: Got It! (+launchpad)
on Jun 26, 2009 at 5:00:32 pm

Nathan, your launchpad looks really nice. Fancy sharing those png's? And thanks Dan for the expressions...



Return to posts index

Nathan Clark
Re: Got It! (+launchpad)
on Jul 5, 2009 at 2:33:28 pm

Hey,

Thanks for you kind words!

I've just posted my launchpad icons + corresponding scripts.

Here it is

Cheers,

--Nathan

On Point Cloud Nine


Return to posts index

Bart Popenoe
Re: Got It! (+launchpad)
on Oct 16, 2010 at 7:23:44 am

Here's a question. I'm looking to modify this script to convert orientation keyframes to rotational keyframes for an entire layer. I've got a comp with a baked camera, 3000 keyframes!

-Bart


Return to posts index

Angie Taylor
Using Smoother on Orientation Keyframes
on Dec 11, 2014 at 7:44:26 am

Hi there,

I wanted to smooth some Orientation keyframes.

I couldn't get Dan's script working on mine for the same reason - baked keyframes from the 3D Camera Tracker. I'm no good with scripts (dyslexia makes it impossible - eel that's my excuse!) but I figured out an analogue method for converting them in AE CC.

Export the comp to Cinema 4D - File > Export Cinema 4D.
Import the C4D file that you created into the AE project, drag it into your comp.
In Cineware, at the bottom in the Cineware Scene Data section, click on the Extract
This will extract the camera from the C4D file.

As C4D does not have an Orientation property it uses Rotation for the animation.

Now you can use the smooth expression on the keyframes to smooth out what was originally Orientation keyframes.

This could be done with expressions or scripts but sometimes in the middle of a job I don't have time to work it out so go for the quickest, dirtiest solution.

Hope this helps,

cheers,

Angie

Angie Taylor animation & illustration for television, film, web and devices

http://www.angietaylor.co.uk
Twitter: theangietaylor
Linkedin: theangietaylor
http://www.facebook.com/pages/Angie-Taylor/118378194869002



Return to posts index

leif falk
Re: Using Smoother on Orientation Keyframes
on Jul 22, 2015 at 11:30:05 am
Last Edited By leif falk on Jul 22, 2015 at 1:03:10 pm

Hi there

Did anyone could modify DanĀ“s script just that it works with keyframed orientation also.
The way with Cineware is nice but not what I am looking for.

Thanks a lot..

EDIT: It seems that pickwicking the rotaion values, reset orientation and than apply expressions do the trick, but you still have the jumps (from 0|+1 to 0|+359) which makes it impossible to use smooth on the camera movement.

So it would be perfect to have a script transforming orientation to rotation and get rid of these jumps by converting 0|+359 to -1|+359?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]