Bake tracker to Roto

trackRoto.py

Everyday we are (compers) doing this process so many times. We use tracker information to do most of the Roto. For doing this we are doing following things:
 
Usually Some compers copy the Tracker node and paste it next to the Roto node which need to match-moved.

Some use to copy paste the Trackers animation value into roto node's Root transform.



Following first step will slow down out script. Think if you have 50-100 roto shapes with tracker node.

Connecting tracker values to roto node is best way, But connecting manually with so many roto node is time consuming process.
So found the solution to automate this process. trackRoto.py.

Run this code with tracker node selected. This will create a roto node with selected tracker nodes  track information baked. So draw shape at any point and it will follow the tracked object..

This code will bake tracking information based on your tracker node. If your tracker node enabled only transform information then it will connect only the transform value. If your tracker enabled TRS then it will connect all the information automatically.

Hope this will help you friends..... cheers..

Updated on 26/12/2013.

Now this code create default roto node while user selected other nodes or nothing is selected.

Download: https://drive.google.com/file/d/0BzfeLEFhrh44SUVKd284OHpyM2c/edit?usp=sharing

code:

##-------------------------------------------------
## trackRoto v1.1
## For bugs please email me at satheesrev@gmail.com
## Compatibility: Nuke v5 - v8 plus
##--------------------------------------------------

import nuke, os, re

def trackRoto():
        sel = None
        try:
                sel = nuke.selectedNode()
                X = sel.xpos()
                Y = sel.ypos()
        except ValueError:  # no node selected
                pass
        if sel is None:
                rt = nuke.createNode('Roto')
        if sel:
                NodeType = re.sub(r"\d", "", sel.Class())
                print NodeType
                if NodeType == 'Tracker':
                        rt = nuke.createNode('Roto')
                        rt.setInput(0, None)
                        rt.setXYpos(X+200,Y)
                        rt['translate'].fromScript(sel['translate'].toScript())
                        rt['rotate'].fromScript(sel['rotate'].toScript())
                        rt['scale'].fromScript(sel['scale'].toScript())
                        rt['center'].fromScript(sel['center'].toScript())
                        rt['opacity'].setValue(1)

                else:
                        rt = nuke.createNode('Roto')


menu.py lines:

import trackRoto
n = nuke.toolbar('Nuke')
n.addCommand('Edit/trackRoto', 'trackRoto.trackRoto()', 'O')


Comments

  1. Hey Satheesh , this tool is great.
    Still many rotos are needed for each project.
    Is there any chance for creating a root folder in existing roto for new trackers?

    ReplyDelete
    Replies
    1. Hi Arun, Thank you.
      I'm not clear with your question.
      You want to create the root folder via python?

      Delete
  2. How to Play Baccarat on the Go
    As the name suggests, it comes from the same basic game card game 메리트카지노 as 온카지노 the 바카라 basic game of poker. In fact, the rules are similar in form to the typical

    ReplyDelete

Post a Comment

Popular posts from this blog

Export Nuke's retime information

Working with UV pass inside NUKE

DeepEdgeSmoother