-
Recent Comments
- mohamed hosni on Paint and Roto Reel:
thank you for supporting me - mohamed hosni on Colour Smear for Nuke (UPDATE v2.0):
thank u - Daniel on Rebuilding bad frames using OFlow:
Love this gizmo and use it all the time. I have added the option to use a Kronos as an alternative to OFlow and submitted a pull request on Github - justin.li on Keyframe Reduction script for Nuke:
keyframe-reducer-for-nuke-master\reduceKeyframes.py”, line 145, in doReduceKeyframes i=getKnobIndex() #find out if user only clicked on a single knob index, or the entire knob File “E:/nukepluginserver/Universal plug-in/NukeShared/Repository/_AutoInstaller/keyframe-reducer-for-nuke-master\reduceKeyframes.py”, line 64, in getKnobIndex return int(nuke.tcl(tclGetAnimIndex)) RuntimeError: Nothing is named “” - srikanth on Colour Smear for Nuke (UPDATE v2.0):
i want to use it for reflector on moving car glass window.
- mohamed hosni on Paint and Roto Reel:

Import “Mocha-AE” tracks to Nuke via Python
July 27, 2012
This is an update to my original post Convert “Mocha for AE” tracking data to Shake / Nuke nodes
***UPDATE***
I must emphasise that this was a test project for me to learn Python for Nuke – what the script is doing is probably in violation of the Mocha end user agreement. As I stated in my original post, the PHP version of the script was a one-off fix for a small job where the facility I was working in did not have a full Mocha licence and I needed a quick solution. I have since been working at bigger facilities that use full Mocha Pro licences, so have not needed to use the script.
Mocha Pro is the current supported way to get Mocha tracking data to Nuke – please don’t use my hacky script as a stand-in for this great piece of software.
A while ago I wrote a PHP script that takes the tracking data generated by Mocha-AE (the version of Mocha that comes bundled with After Effects) and converts it to Shake and Nuke nodes.
Well I had a quiet spell over the last couple of days and thought I would use it to learn Python. My first project was to re-create my Mocha-AE import script, but have it run natively within Nuke. This would force me to cover some Python basics such as importing files, parsing strings to generate arrays etc. as well as some Nuke specific functions like creating nodes and adding animation data. I also wanted to extend the script to create a CornerPin node as well as a Tracker node.
I was surprised how quickly this came together. There are some great online resources such as The Foundry’s website and Nukepedia, and I find Python quite a simple and logical language to learn.
So here is my code. I will give the disclaimer that it is literally the first thing I have ever written in Python, so I’m sure that it could be more efficient. If you know any ways to improve its functionality, please leave comments below.
As with the previous version, this assumes you have used the “After Effects Corner Pin [corner pin only, supports RG Warp and mochaImport] (*.txt) “
export method from Mocha-AE.
You can wrap this up into a menu item to give your Nuke install permanent access to it as a function (I may update this post as to how, but until then try here), or the simplest way to run it is to just copy the code below and run it via Nuke’s Script Editor panel.
Here is the GitHub link for the code – just select the text, copy it then, then paste it into Nuke’s Script Editor panel.
4 Responses to "Import “Mocha-AE” tracks to Nuke via Python"
Henrique Reginato says: October 1, 2015 at 8:17 pm
Hey man, this is awesome and i have been using it for quite a while… But I’m having trouble wrapping it up into a Menu item…
have you figured out how ??
The closest I got was still launching the tool together with Nuke and the menu I created was unresponsive…
Raymond says: July 9, 2017 at 1:23 pm
Hi Richard… I’m not sure but I believe I used to work with you in dneg where we used your script and incorporate it into dneg Singapore’s nuke.
Anyhow, are you familiar with Natron? It’s like a clone version of nuke but difference is it’s free. I was wondering if it’s possible to have a mocha ae python script for that compositing software.
Awesome!!! Thanks so much for sharing this Richard!