After Effects To Blender 2.70a Javascript Python Generator

Hi All,

I have revised the After Effects To Blender exporter to update it for Blender 270a api changes. See post #44 for caveats with this version.

As far as tracking and camera matching tasks, however, we are still in untested waters.

The concept behind this Adobe Javscript (.jsx included in the attached ZIP file) is like any other exporter. The exporter scans the host application for data and generates output in a different format. The format, in this case, is Blender 2.70a python.

USAGE:
Run the Javascript from the After Effects File\Scripts\Run Script File menu..
Select the layers you want to export in your After Effects comp.
Click the export button and wait for python generation to complete.
Exit or Hide After Effects.

Locate the generated python script (many times it just appears on the desktop).
Open Blender 2.70a or better and load the generated python script into a text window.
Run the code in that window.
The code in the python script will attempt to construct a scene similar to the scene in After Effects.

FIXES For Alpha v1.0:
It now works in CS5 &CS6 (yeah!).
The correct FPS is being relayed to Blender from After Effects.
Text from After Effects appears as extruded font object inside Blender.
Footage layers appear as correctly sized planes with a material applied to them pointing to the footage.
Axis orientation for the whole Blender scene is rotated 90 degrees along the x-axis to match After Effects.
Lens default value more closely matches After Effects for a tighter Pixel-to-Pixel match.

FEATURE ATTEMPTS FOR ALPHA:
I am calling these attempts because the code is still in that state.
Full Camera Animation (need to test animating FOV, DOF, is aspect ratio right…?)
Solids are exported as animated empties.
Footage is exported as a plane with a material assigned to it that links the AE footage to the plane as a movie or image sequence texture. (Ambitious, but I think necessary to make this a one-shot wonder kind of script.)
Text layers from AE are converted to actual 3D font objects in Blender.

TODO:
Lots of testing needs to be done.
I have tested it on a couple of scenes with CS5 and CS6 only. So further testing on creative cloud versions is needed.

Attachments


ATOM_CS5_AE_2_Blender266_04162013.zip (18.1 KB)ATOM_AE2Blender27_05302014.zip (15.6 KB)

3 Likes

thanks for all your cool work :slight_smile:

It work for Cs5 too…but rotation doesn’t work…and I must rotate camera -180 degree on X axis in blender to match with after effect…

Nice to know. I cloned the Lightwave exporter when I began my 2.49 script. Next time I am working on the script I’ll include that as a change.

So if you exported an animated camera, how did you rotate it 180 degrees in Blender without losing the animation?

Parent camera to Empty object…then rotate it,one more thing we need to adjust camera focal length in blender same like after effect…But that is easy thing to do…,

So glad i found this thread. If I use the script in AE CS5 on a Mac the resulting python script seems to have no line breaks when opened in any blender version.

Any idea how to fix that?
Thanks so much!
Andre´.

It was the same on CS3. It is a known After Effects Javascript bug. it was supposed to be fixed by now. There are some 3rd party text editors that can repair the output but I don’t know Macs all that well.

Hey, Atom, just saw this thread, and you seem to be the only game in town! Any further progress on getting this guy going for Blender 2.6?

I can get the camera to export into Blender, but it is off-kilter, and I’m unsure of how to re-orient it. I did parent the camera to an Empty, but I guess I’m screwing it up since it pivots the camera around the origin like a big hinge.

Anyway, my test consists of a simple text layer and a camera movement. The camera exports, but when I try to include the text layer it sits on “Checking for Animation” for a long time. Does this just take a long time or am I missing something?

Thanks for your work on this script, it could be EXTREMELY helpful in my future projects.

Chris

The free app “Text Wrangler” can put in the needed unix line breaks to the exported .py file. The script runs in blender 2.59, but unfortunately the everything sticks on the x axis in the blender world. Sorry, but I can´t help more :frowning:

Has there been any progress in this area? After Effects has the new camera tracker now and it would be great to do everything there, export the camera data and some solids into Blender, do the 3d stuff, then just render and finish all the stuff in AE.

I’ve been looking for a solution before Blender introduced its own camera tracker, we had The Foundry Camera Tracker in AE which was a dream come true. I think integrating apps is the future - 3dsmax and After Effects have this kind of relationship already.

Thanks Atom for doing a great job before but the script doesn’t transfer camera rotation animation in CS5.5 and CS6. Is an update possible? Anyone? :slight_smile:

This is my “placeholder post.” I am trying to download the script linked above, but I haven’t posted ten posts yet, which I think is the reason I can’t download it. Rather than filling up the forum with 10 extra posts when I have nothing to say, it would be great if the forum moderators could help me to access the link to the script. Thank you.

Number of posts shouldn’t have any affect on you downloading files. What problem do you have when you try to get the blend file ?

There was an attempt at converting Mask data to Blender curves.

A while back someone came in the ba.org looking for a way to convert his Mocha or AE mask files to blender. I did write one but it’s sort of limited to spline points. AE and Mocha seem to use X-Spline which i think is a lot like the new curve type used for masking…

if anyone is interested. but with the new-fangled mask tools, i can’t imagine anyone wanting to start rotoscoping inside an external app any more.

There was an attempt at converting Mask data to Blender curves.

With Mask editing in trunk, mask data should be imported as actual mask! :smiley:

The camera being off kilter is probably due to the API change in the matrix order from 2.6.2 to 2.6.3. This script certainly could use more development. I currently don’t have the time for such work on this script. The problem should be fixed in the javascript portion. Try swapping Z for X when writing out the final coordinates for the camera.

Thanks Atom for your reply. I sure can understand that you’re busy but the number of people who could update the script is quite limited, I suppose. I have no idea about coding, I tried to do some stuff in the past but then moved on to other things. I’ve been looking into the code and thought that the reason behind rotations not coming through is for example this:
For position there is a value [0] indicating which axis this means, e.g.:
var temp_xpos = layerCopyParent.position.valueAtTime(t, false)[0];

However, for rotation we have this:
var temp_xrot = layerCopy.rotationX.valueAtTime(t, false);
There’s no [0] at the end. But even if I added it (everywhere where I spotted it “missing”, [1] and [2] for other axis respectively) it doesn’t help. That was just a crazy guess and as far as I could go not knowing the code at all :wink:

Sometimes AE’s orientation (not rotation) comes through but only in one axis and still not correct. Swapping Z for X etc. in AE wouldn’t be a problem if just the numbers would go through, we could use expressions and fix it, but we really need somebody to fix the script. If it worked at least in CS5 (I’m aware that not everybody has updated to CS6 yet), that would be a great thing. I’m really trying hard to trust Blender more and introduce it into my workflow in one of the projects I’m doing now. Thanks in advance!

but the number of people who could update the script is quite limited
Ok, so I took another stab at it.

I have updated the script from Alpha to Beta. I feel it works a little better now and I have corrected the CS5 bug so it should run in After Effects versions other than CS3. I was using a depreciated call to activate the OS dialog. That has been corrected.

I am calling this release Beta v1.0. Feel free to test away and post bugs/suggestions!

Sorry for replying so late, I was away and without regular Internet access. Just imagine my big smile when I came back and noticed your update :slight_smile: Thank you so much for doing this Atom. I’ve run the script in CS6 in a crane shot - it seems that the motion is reversed (the crane in AE goes up, in Blender it goes down) but the most important thing is that the rotation and other movements are being transferred, not like with the previous script used in versions above CS3.
I’ll test it more in the following days and post some conclusions. I have one big project coming and I would love to use AE with Blender on that job, which is impossible without your script.

If you have a small CS5 (I don’t have access to CS5.5/CS6 at this time) After Effects aep file that shows this reversed up/down problem, post it here in a ZIP file and I’ll take a look. When I read your post it made me realize I had not tested UP/DOWN camera movement, just movement into the scene via Z translation.

I’ll prepare a file tomorrow when I get access to CS5 and post it here. Thanks so much Atom! :slight_smile:
EDIT:
Ok, I’ve created two simple compositions in AE CS5, highlighted all the solids etc, run the script and then opened it in Blender 2.63a (after deleting default elements in the scene). I’ve done no changes afterwards, just saved the files.
You can download the files here: https://www.dropbox.com/sh/j9vs16tdyx99b01/rEuql7R9zK
The comps:

  1. The crane shot tracked the dirty way using The Foundry Camera Tracker in AE CS5 - in Blender the camera moves down instead of up. I’ve added some solids for reference, the footage solid is very big but this is because it’s 2D in AE I suppose. I’ve included the footage in a separate zip file (it’s very small) in case you need it. Here’s a preview:


  2. AE normal composition - I’ve just added a 3d solid, animated the camera a bit and added two text layers. They look completely different in Blender in the first frame - they’re out of frame.

After Effects first frame:


Blender first frame:



Is it because of the lens? It’s set up as 28mm in AE, I haven’t touched it in Blender. The movement of the camera is also a bit different in Blender :wink:

Thank you for your time and effort Atom :slight_smile: I’m looking forward to your findings.