Hello. here's something to help you. If you don't select the nodes, it'll run on all roto nodes of the script.

It works, but sometimes you'll need to run it twice (currently without time to find the flaw). Watch out the console and you'll see if any of the curves will end with opacity at 0 and run it again.



import nuke

def SetRotoShapesOpacityAll():
    if not nuke.selectedNodes():
        nodes = nuke.allNodes('RotoPaint')
        nodes.extend(nuke.allNodes('Roto'))
    else:
        nodes = nuke.selectedNodes('RotoPaint')
        nodes.extend(nuke.selectedNodes('Roto'))
    for n in nodes:
        nodec = n['curves']
        nlayer = nodec.rootLayer
        for curve in nlayer:
           allAttributes = curve.getAttributes()
           allAttributes.addKey(0,"opc",1) #set opacity to 1 at frame 0
           allAttributes.removeKeys(9) #removes opacity keys
           print curve.name, allAttributes.getValue(0,"opc")
        nodec.changed() # updates the roto UI

SetRotoShapesOpacityAll()





Hi,
Im trying to clear all the animation value for the opacity knob in all of the curves inside a roto/rotopaint node and set the value to 1. Been reading some stuff over google, but im not that well versed with python scripting. Hope to get some help about this.

Best,
Jeff

Sent from my Windows Phone



--
Magno Borgo
www.boundaryvfx.com
www.borgo.tv
Brasil:Curitiba:GMT= -3
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to