f
f
Global SectionArticlesBookstoreDictionaryDownloadsDVDsEventsForumsGalleryJob ListingsNewsNewslettersSchools
 Advanced Search
USER: PASS:  Login  Register

Subscribe
Site Links
Home > Nuke > Downloads > tcl scripts > mocha_import.py (python for Nuke 5.x) Change background colorChange background colorChange background colorChange background color
mocha_import.py (python for Nuke 5.x) 0.0.2
Import tracking data from Mocha to Nuke 5.x
Login to add a Bookmark 0 votes for an average rating of 0.00

 

UPDATED:   04/23/08  
FILE SIZE:  5 KB  
DOWNLOADED:  241  
HOMEPAGE:   http://www.yawpitchroll.com
LICENSE TYPE:   Freeware
Nuke Versions:   4.x
OWNER:   michaelmov    Author Name:  Michael Morehouse
User Comments
Be the first to write a review!

 

DETAILS:

NOTE: ONLY WORKS ON NUKE 5.X (WITH PYTHON SUPPORT)

Skip part 1 if you don't want to import rotospline shapes as beziers and are only interested in the 4 point tracking data for the mocha surface.

PART 1 (OPTIONAL) : Importing Mocha (and Shake) .ssf shapes to Nuke:


Download the ssf importer and put it in your MacOS/plugins/ directory (there are two plugins directories created on the Mac at install for some reason, make sure you use this one. On the PC should simply be the /plugins/ directory).

Find your toolbars.py file (see instructions in Part 2) and add this to The "Draw" Menu:

def py_ssf_import():
    ssfFileName__ = nuke.getFilename("Shake Shape File", "*.ssf"); ssfString = 'nuke.tcl("import_ssf ' + ssfFileName__ + '; return")'; eval(ssfString)
m.addCommand("SSF Import", "nukescripts.py_ssf_import()", icon="Bezier.png")

EXTREMELY IMPORTANT: The bold line, (from ssf_FileName to eval(ssfString)) is a single, wrapped line, and it MUST be indented 4 spaces from the left, or copy and paste from the attached txt file.

Reboot Nuke, then click the new button in your Draw menu and search for an .ssf file you've exported from Mocha or Shake.

PART 2: Mocha Tracking Data Import (much less beta version)

Instructions:

Download attached mocha_import.txt file, rename to mocha_import.py ... save it to your ../site-packages/nukescripts/ directory (search for my earlier post of autobackdrop.py if you don't know where to find this).

Open the __init__.py file you'll find there and add from mocha_import import * to an appropriate line (I just keep them in alphabetical order).

Open toolbars.py and add this line m.addCommand("Mocha Import", "nukescripts.mocha_import()", icon="Tracker.png") to the bottom of the section that starts with # The "Transform" menu.

You're now installed, restart Nuke.

To test track a shape in Mocha, adjust track if desired, and use the Export Tracking Data button on the bottom of the tab you're on (don't know if this matters, but I used the one on the Adjust Track tab just to be safe after doing the adjust, as I believe the Export Tracking Data button on the Track tab may export the data for the un-adjusted track only).

EXPORT AS A SHAKE SCRIPT .SHK FILE

Open Nuke, hit the fancy new button, and when the file browser pops up find and selected your just exported Shake file.

Should pop up a new Tracker node with the tracks in place, Transform Rotate and Scale turned on, all four tracks enabled, and the Label set.

Couple of caveats:

1) put in some logic that MAY work if the mocha track does not have info on all keyframes, but haven't had a chance to test it. Let me know what happens if you try this (btw, if you have Script Editor window open when you run this you'll get some useful error messages if it all goes Michigan ... copy and paste those into any error reports you send me.

2) Not that much of a genius with Mocha yet, but it APPEARS that it'll only export one layer/shape at a time ... that's good, cause this will only load one, and what its actually doing is loading the points for the four corners of the Surface, so make sure that's what you're after.

3) This isn't designed to import Shake scripts directly, but I'm guessing if you were to throw a single shake CornerPin or MatchMove node (NOT A STABILIZE) through it it might very well work ... again test and let me know. (Reason why Stabilize won't work is that this routine truncates the export from Mocha to only the top node of the three in the .shk (mocha provides you with a CornerPin, Stabilize, and Matchmove for you in one export) so that I'm not trying to work with 12 trackers. I might improve the way this works in the future, if I have time.

4) Nuke is doing the actual calculation of Scale, Rotate, Center, etc for matchmove ... results may differ from Mocha, but I haven't been able to figure out how Mocha is exporting that anyway to Shake, so probably not much of a change if any. Only export that properly throws that all out is the AE one, but that rounds funny and I figured going off the Shake one would make more sense to most people.

NEW FOR VERSION 0.0.2
Imagineer have announced a Beta release of mocha 1.2.0 which offers a Nuke export.  This export is in its early stages, I hope, as it goes the rather clumsy route of exporting one ascii .txt file per corner of the surface, resulting in many, many keystrokes to import it.  I've now added support for this format too, so when you go to open the file it will ask for either a .shk file or one of the quad of .txt files that mocha exports with _Tracker#.txt as the filename.  As long as you selected one of the two file types and the data is there this should work pretty much identically whichever export routine you've decided to use.

To install over an older version: just copy the mocha_import.py file into the same directory you installed it to in the steps above and overwrite any earlier version.  Once you've restarted Nuke the toolbar icon should work exactly as before.

Enjoy!
.

Login to add a Bookmark 0 votes for an average rating of 0.00

 


Related Learning Tools
Nuke Related DVDs

No Results.
Nuke Related Books



The Art and Science of Digital Compositing
Global DVDs



Shake 101: Interface and Workflow

tcl scripts for Nuke

  Top Rated
  1. PasteToSelected
  2. AutoBackdrop
  3. ssf importer
  4. SmartRead
  5. drop.tcl
  Most Downloaded
  1. drop.tcl
  2. SmartRead
  3. import boujou2
  4. Nuke to Alfred
  5. ssf importer
   Top Forum Posts
  1. Film Stock

Featured Art

the Gnom Hotel room AML_Bulldog mkll





Sponsors

Sponsor

Contact Us | Post Jobs | Post News | Post Events