Yes, you can get and set the color of the shape and pretty much any other
attribute.
Check this for a list of available attributes, and methods to get/set them

import nuke.rotopaint
help(nuke.rotopaint.AnimAttributes)

To set the overlay color of all shapes to red, for example, you can do:

n = nuke.toNode('Your_Roto_Node')
for item in n['curves'].rootLayer:
  attr = item.getAttributes()
  attr.set(nuke.frame(), 'ro', 1.0) # set red overlay to 1.0
  attr.set(nuke.frame(), 'go', 0.0) # set blue overlay to 0.0
  attr.set(nuke.frame(), 'bo', 0.0) # set green overlay to 0.0

Or, to get the name and current color of each shape (not the overlay color,
but the actual fill color):

n = nuke.toNode('Your_Roto_Node')
for item in n['curves'].rootLayer:
  attr = item.getAttributes()
  print item.name, [attr.getValue(nuke.frame(), '%s' % color) for color in
'rgb']


Cheers,
Ivan

On Fri, Apr 1, 2011 at 1:11 PM, Scott Squires <[email protected]> wrote:

> Related question:
>
> Is there a way to access the color assigned a shape and change it?
>
> Thanks,
> Scott
>
>
>
> On Mar 26, 2011, at 8:48 PM, Nathan Rusch wrote:
>
> > Rotopaint Layer objects are iterable and indexible like lists.
> >
> > # Assuming n is your Rotopaint node
> > r = n['curves'].rootLayer
> > for item in r:
> >   print item.name
> >
> > -Nathan
> >
> > -----Original Message----- From: Nick Stevens
> > Sent: Saturday, March 26, 2011 11:25 AM
> > To: [email protected]
> > Subject: [Nuke-python] Listing all curves/elements in rotopaint
> >
> > Does anyone know how to get a list of all the curves/elements (ie
> beziers) in a root/rotopaint node? I need to run the list through a loop.
> >
> > Thanks,
> >
> > Nick_______________________________________________
>
> _______________________________________________
> Nuke-python mailing list
> [email protected]
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
_______________________________________________
Nuke-python mailing list
[email protected]
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to