Maya Ascii camera export script

I think I found a bug in the AE export script.

Correct me if there is an easy workaround or the fault is elsewhere…

It seems as though the coordinate system has the Z and Y axis’s swapped. Its very evident when setting up a particle system like CC particle world or particular; the camera still follows fine, but any gravity settings make the particles fall sideways rather than down like expected.

bump

Anyone else here who can confirm the same problem I’m having? It works awesome except for this problem; and with it turned sideways like this, 2.5d particle systems are kind of worthless.

After doing a bit of googling and reading, it appears the problem I’m having isn’t unique to this script. The whole Z is up vs. Y is up clash occurs everywhere in the 3D world, apparently. So, it looks like we need some kind of matrix transform (?) on the data to be imported into After Effects, as AE is Y-up, and Blender is Z-up, and neither have options in-software for altering this. I already took a look at the script, thinking I could prod it into working correctly,but its way over my head. Please help!

Very happy to hear it’s of use to all of you. :slight_smile:

I originally had it setup like that but in order to make the object positions exact and take account of constraints etc. it stores the keyframes per object at every frame. This makes a lot of keyframes and I found that After Effects choked pretty quickly when the scene became more complex.

This would force you to always hide objects in layers for exporting, which isn’t the fastest workflow. The null method means that you get accustomed to using nulls as trackers instead of using object centers and you can add/delete these trackers very easily and have them follow complex constraints plus it means the exporter doesn’t need any options to select and you don’t have to hide objects in layers to keep the export size down.

I know it’s an extra step to do but for being optimal, it really has to be this way. AE choked pretty quickly doing a stress test. I think I tried to export 1000 frames with 10 or more objects animated and it took minutes to import. Shake did it much more quickly but there was noticeable slowdown vs only importing the essentials.

I actually tried to use Maya itself for a camera export and I couldn’t believe you have to bake all your keyframes manually before exporting:

http://www.highend3d.com/boards/index.php?showtopic=240035&mode=linearplus

I’m sure there are scripts to help but it doesn’t look like Autodesk include them by default. I think Shake is supposed to have Maya integration but the Maya workflow as described above is horrible. Having to bake the camera is terrible because it basically adds a keyframe per frame to your actual camera data so you have to make sure to undo it before saving again.

I wanted the workflow to be as simple as file > export and just save a file because I found that I did a number of tests over and over so having to redo the baking manually would be so slow. Shake allows you to overwrite your import so if you have a composite setup, you just have to render out your frames/passes, export the tracking and just update the nodes in a matter of seconds and it applies all your effects to your new render.

Yeah, when I saw what people typically used for motion graphics work, it was Cinema 4D as it has a mograph plugin that links the two apps and I just thought well, I use Blender and Shake so I’m going to find a way to make it work and AE used the same import scheme.

I’ll see if I can recreate it. I’ve seen the problem of Blender exporting models the wrong way round for apps before. The object locations from the script appear in the right locations though so I’m not sure why the gravity would be wrong but I’ll try and see what’s up. It’s important that those kind of things work right. Thanks for testing it.

Ok, I flipped the axes round so that y is up instead of z as is the AE default. This means that when you drop a layer in and make it a 3D layer, it stays upright instead of laying down flat and ccparticles fall the right way by default - you can change the axis directions in ccparticles (options link next to effect title) but having y up complies with the defaults.

I also changed the scene scale to 100 from 200 so that the imported camera values correlate more closely to Blender’s. The reason it scales at all is because Blender’s units are in meters but Maya’s defaults are centimeters and AE ignores these values along with some FPS settings on import, even from Maya.

If you can check to see everything is still tracking ok, I’d appreciate it. The file is available here:

osxrules, this is awesome. It works flawlessly, so far as I can tell.

I’ve posted a quick test here.

Particles and text were composited in After Effects CS3, Trapcode Particular 1.5 was used to generate the particles.

Thanks again for all your work on this. Now we just need a way to get camera data IN to blender. :smiley:

Great, that seems to be working ok.

Someone else asked me this a while ago but I hadn’t checked here in a while so I missed the message but there seems to be a solution. There is a .jsx export script in this thread by Atom:

http://blenderartists.org/forum/showthread.php?t=152390

That might do the trick.

as said a time ago: OSX RULES!!! :wink:
Dude, awesome job (i didn’t test it yet the last version, but thanks for the effort!)

could this script be bundled together with the official blender installer…? :slight_smile:

could this script be bundled together with the official blender installer…?

+1

i thought that.

Using it to export blender 2.48 camera to Maya 2009.

It has some flaws, like getCamera in python is depreciated and wrong scale and orientation etc. But produces nice usable curves as a start…

Thanks for testing it. I was busy focusing on getting it working in AE, I should have checked more closely with Maya - that would have saved a bit of time on the changes I made last time. There were a couple of things not quite right.

I have updated the scripts here:

http://dev-art.co.uk/files/tracking_ae.zip
http://dev-art.co.uk/files/tracking_shake.zip

I had scaled AE’s scene because the tracking points look huge and this is why the scale was off in Maya. I have put the tracking point scale back to 1 and this will save having to scale objects parented to the tracking points but the scene scale is still higher.

The Shake script doesn’t scale the scene because Shake already does this in its importer. So for exporting to Maya, you can use the Shake script.

I have included scale values in the latest script too and I fixed the deprecated functions.

I’d still like to make a couple of optimizations later on but this should solve the existing issues. Any problems, let me know.

This doesn’t work in blender 2.49 - is there a link to a new script, or possibly could this one be updated?

~thanks, Istvan.

Yes, I’m getting some trouble here as well.
Running ver. 2.49a

I tested it on the Mac and Windows version of 2.49a and it worked ok. What is the error message you get in the console? Check the previous page to see if it’s the same error.

I am running linux if it matters, 2.49a - I will debug when I get home, i’m off for a few hours now.

Thanks for the quick replys!

Hi osxrules, I was just wonering…
What is the chance of getting object animation happening?
You discussed it as a possibility in an earlier post. Has there been any developments?

I guess I could put it in as an option - I might have to put an interface on the script. The reason I didn’t use it was because when you export, objects can have IPOs but aren’t animated, which means it dumps a load of empty keyframes, which then slows down imports.

The workaround is to only export empties and to get object animation data, you just make an empty and then make it a child of an animated object.

This means you can position a tracking location to an object rather than sticking with the object center and defining an offset in the compositing software.

I should be able to optimize the data by comparing adjacent frame value changes and only storing the active data but I have to watch the curve tangents when importing and it will have to be optional because not everyone will want the keys from all animated objects imported. If you just want to composite one tracked object for example and you have 100 animated objects, you’re only going to need the camera data and one IPO for the tracked object vs 100 IPOs, which can be a lot of data.

Ideally, I’d like to get it to the point of being a complete Maya Ascii solution including being able to export geometry for Maya because people who sell Blender models need a decent exchange format and OBJ, 3DS etc don’t always cut it. A lot of people use Maya and being able to drop Blender data out directly would be very useful. Having it import too of course.

That could take a while to get to that point of course. In the short term, I’ll try and get the data optimized and put a basic interface on it. This way I can merge the Shake/Maya and AE scripts into one and give people the option of object data export for convenience.

Ok, I have modified the script to export objects and it will check which objects are animated and only export the necessary keyframes.

I just added some options at the top of the script to switch between AE, Shake or Maya so you don’t need separate scripts for each:

http://dev-art.co.uk/files/tracking.py.zip

The export this time will take longer because it has to check every object for every frame to see if it moves. As before though, it won’t export hidden layers so if there are a lot of objects that aren’t useful to the tracking, hide them. If you put your nulls and camera on one layer and only make that visible at export, it should get the same speed as before.

I did a test of over 4500 objects in a scene exported over 250 frames and the export time was about 1 minutes 40 seconds vs 22 seconds with the previous script. I can add an option back in to limit the export to nulls and cameras later if the performance is a problem.

I also added a limiter in the script, which only exports up to a fixed number of static objects for Shake and AE. Neither of them can handle importing 4500 tracking points. I put it at 500 objects and it works ok with that. There is no limit on animated objects and they will all export.

I may be able to optimize the speed of the export in various ways, it needed more changes than I though to do the checking and a couple of ways I tried weren’t good as they used way too much Ram, others were slow because Blender’s set(curframe) function is very slow if you run it a lot of times.

Anyway, try it out and let me know what you think about it.

Hi I have problems running this script:(. Can anyone please help:).
Vist 64
Python 2.6.2 64amd
Blender 2.49a 64

The error in the console is listed below. I hope there are not any typos.

File “<string>”, line1, in <module>
File "C:\Program Files|blender-2.49-win64.blender\scripts racking.py, line
11, in <module>
from Tkinter import *
File “C:Python26\Lib\lib-tk\Tkinker.py” line 38, in <module>
import FixTk
File “C:\Python26\LIb\lib-tk\FixTk.py”, line 63, in <module>
import _tkinker
ImportError: DLL load Failed: The specified module could not be found.

Thanks in advance.