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: lifetimeRoto.py

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 ?

lifetimeRoto.py 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: lifetimeroto.py

menu.py lines:

import lifetimeRoto

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

Full code:

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

import nuke

def setRotoLifeTime():

### get selected node
    selNode = None
    try:
        selNode = nuke.selectedNode()
    except ValueError: # no node selected
        pass
    if selNode == None:
        nuke.message('make sure your roto node selected')
        return
    ### 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
            selNode['lifetime_type'].setValue(4)
            selNode['lifetime_start'].setValue(low)
            selNode['lifetime_end'].setValue(high)


Comments

  1. Slots by Raging Bull - DrmCD
    In this video 대전광역 출장안마 I will 제천 출장마사지 describe the classic Slots by Raging 태백 출장샵 Bull, a classic 안양 출장샵 from 통영 출장마사지 Raging Bull, made by Pragmatic Play.

    ReplyDelete

Post a Comment

Popular posts from this blog

Export Nuke's retime information

Lock and unLock node settings in nuke

Working with UV pass inside NUKE