top of page
  • satheesrev

Automate Roto shape life time settings.

There are various ways to set the lifetime of roto shapes. Some artists prefer using the lifetime tab in the roto node, while others move the roto shape outside the working resolution. Some people use the ‘multiply’ node to achieve this, and some artists animate the ‘visible’ knob in the roto node. The method of doing this varies from artist to artist.


lifetimeRoto.py sets selected rotoshapes lifetime based on keyframes. It gets the selected shapes keyframe value and applies min and max to lifetime start and end.





Final .py 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)



2 views0 comments

Recent Posts

See All

Automatically pin the Cornerpin in Nuke

This little code place the cornerPin nodes 4 pin's automatically based on the bbox. If your image dosen't have bbox add a crop node and crop it as per your need. import nuke def autoPinning(): selNode

Comments


bottom of page