roto shape life time settings

roto shape life time based on keyframes

This is long time request. I haven't got time to look into this after joined in MPC. Got some time yesterday. Thought to update my blog with new tool. Here is the simple tool but much needed one ( i hope).

One of my friend requested to automate roto shapes lifetime based on the key frame. We use multiple way to set roto shapes lifetime. Some artists uses lifetime tab in roto node, Some simply move the roto shape out of the working resolution. Some guys are using 'multiply' node to achieve this. Some artists animating 'visible' knob in roto node. The way of doing this will differ from artist to artist. How to make this organised ?.

Here is the idea:

Most of us using nuke roto node lifetime tab set the lifetime based on the frame range.

Some artists using mouse click option in curve window in roto node.

In both way we need to feed the frame range either we need to choose to-end or to start. Doing this is not time consuming task for compers. But for roto & clean-up artist ? automatically sets the selected rotoshapes lifetime based on the shapes key frame's. This code get the selected shapes keyframe value ( example: 10, 20, 30) and apply min and max to lifetime start and end respectively.  After i run this code my roto shape lifetime set to 10 - 30 automatically by single click or short-key.

I have assigned 'shift+L' as short-cut. Select your roto shape and make sure you have selected the roto node. Run this shortcut, Boooommmm. Your roto shape lifetime sets based on the keyframe.

I hope this will helpful. Feature request and bug reports are welcome.

Download: lines:

import lifetimeRoto

menuBar ="Nuke")
menuBar.addCommand('Edit/Node/lifetimeRoto', 'lifetimeRoto.setRotoLifeTime()', 'shift+l')

Full code:

Created on 07-april-2016
@author: satheesh-R
mail -
### to set selected roto shapes lifetime based on the min max keyframes value.

import nuke

def setRotoLifeTime():

### get selected node
    selNode = None
        selNode = nuke.selectedNode()
    except ValueError: # no node selected
    if selNode == None:
        nuke.message('make sure your roto node selected')
    ### find selected roto shapes keyframes
    if selNode.Class() == 'Roto':
        for selShape in selNode['curves'].getSelected():
            keyFrame = selShape[0].center.getControlPointKeyTimes()
            keyFrames = [int(i) for i in keyFrame]
            low = (min(keyFrames))
            high = (max(keyFrames))
            ### applying min max keyframe to per shape lifetime

Popular posts from this blog

2D Volumetric rays in nuke

Nuke workFlow optimisation TIPS

Export Maya camera and Objects to Nuke