randomRotoColor

randomRotoColor

Created a node with python button called "randomRotoColor". It applies random color values to the individual roto shapes on selected roto nodes in nuke. Nicolas Houle made this script for help me out. I made some manipulation on that script and make it work really handy. You can apply random overlay color value to each roto shapes.

Add this node into your node-graph. Select the roto nodes ( multiple or single ) and click the randomRotoColor button. Your roto shapes are changed their color values randomly from default white color.

Before:




After randomRotoColor applied:


I made it randomRotoColor gizmo. you can download it from below link.


else copy below code and run it from nuke's script editor:

def randomRotoColor(elem):
for i in elem:
if isinstance(i, nuke.rotopaint.Layer):
randomRotoColor(i)
elif isinstance(i, nuke.rotopaint.Shape):
attrs = i.getAttributes()
randR = nuke.expression('random()')
randG = nuke.expression('random()')
randB = nuke.expression('random()')
attrs.set('r', randR)
attrs.set('g', randG)
attrs.set('b', randB)
for i in nuke.selectedNodes():
rotoCurve = i['curves']
rotoRoot = rotoCurve.rootLayer
randomRotoColor(rotoRoot)


Below code works with "Group node":
( This code will apply random colors to all roto nodes inside the group )

def randomRotoColor(elem):
for i in elem:
if isinstance(i, nuke.rotopaint.Layer):
randomRotoColor(i)
elif isinstance(i, nuke.rotopaint.Shape):
attrs = i.getAttributes()
randR = nuke.expression('random()')
randG = nuke.expression('random()')
randB = nuke.expression('random()')
attrs.set('r', randR)
attrs.set('g', randG)
attrs.set('b', randB)
tos = []
for a in nuke.toNode('Group1').nodes():
if a.Class()=='Roto':
tos.append(a)
for b in tos:
rotoCurve = b['curves']
rotoRoot = rotoCurve.rootLayer
randomRotoColor(rotoRoot)

Hope it will help you guys.



Popular posts from this blog

2D Volumetric rays in nuke

Nuke workFlow optimisation TIPS

Export Maya camera and Objects to Nuke