Hi all,
First time posting here.
I'm trying to insert a piece of code that assigns a random color to a
roto shape upon its creation, giving each shape a unique-ish color
automatically.
I'm still not that familiar with Nuke python, and I'm having a hard
time finding a callback entry for something like "onShapeCreation" in
the rotopaint module.
I'm also at a loss with where to register this callback (if it
exists). Should it be done in an init script (i.e. init.py or menu.py)
or somewhere in Nuke's UI?
Any pointers are greatly apprecited.
This is the code I'm trying to run at each roto shape creation:
----------
knob = nuke.toNode('Roto1')['curves']
shape = knob.toElement('Bezier1')
# perhaps grab the newly created shape object without referencing it
by name? Is that possible?
attrs = shape.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)
# refresh viewer and color knob
----------
Thanks in advance.
Best,
-David
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python