Hi Ivan, thanks a lot for that reply, very informative. I've played with the code you posted and it works very well for adding keyframes to the rotation parameter
layer = curves.toElement("Layer1") t = layer.getTransform() for i in range(1,10): t.addRotationKey(i,0,0,i) curvesKnob.changed() However, it makes me realize that I have a lot to learn as I find the syntax for the RotoPaint node quite difficult. What I want to do is to add keyframes to the "transform_matrix" knob. I looked at the help functions, but I'm still unsure how to access that. As far as I see addTransformMatrixKey isn't available. Maybe a workaround would be to somehow select a layer in the RotoPaint node via python? Then I could just use the normal code, like node["transform_matrix"].setValue(). Thanks a lot for your help! Best regards, Simon 2012/7/2 Ivan Busquets <ivanbusqu...@gmail.com> > Hi Simon, > > Because those knobs don't exist per-layer/shape, and just manage the data > of the layer(s) depending on the selection, I think you'll be better off > just setting the transform data for the layer you're interested in, without > interacting with the transform knobs. > > There's a couple of ways you can go about it: > > ... > > layer = curvesKnob.toElement("Layer1") > > t = layer.getTransform() # This is an AnimCTransform object that you can > use to manage/store the transformation data for this layer > > t.addRotationKey(nuke.frame(),0,0,5.5) > > curvesKnob.changed() # Because we didn't change any knobs, the interface > won't show the changes until you call this > > > Or, if you don't want to be adding keys and would like to set a constant > value instead, you could do: > > ... > > layer = curvesKnob.toElement("Layer1") > > t = layer.getTransform() > > rot_curve = nuke.rotopaint.AnimCurve() > > rot_curve.constantValue = 15 > > t.setRotationAnimCurve(2,rot_curve) > > # Not sure why the index value needs to be 2 here. > > # Logic says it should be 0 (since rotation can only hold one value/curve), > > # but there might be a reason for it. > > curvesKnob.changed() > > > For more info on the different classes/methods you can use to manage the > data of Shapes, Layers, etc, look at: > > > help('_curvelib') > > help('_curvelib.AnimCTransform') > > help('_curvelib.AnimCurve') > > etc. > > > Some of the help and function signatures are not quite as detailed as they > could be, but hopefully that'll give you enough information. > > > Cheers, > > Ivan > > > On Sun, Jul 1, 2012 at 11:50 AM, Simon Björk <bjork.si...@gmail.com>wrote: > >> Hi all, >> >> I'm having trouble to find the right code to access knobs on a RotoPaint >> node (per layer). If I run nuke.selectedNode()["rotate"].setValue(20) on a >> selected node it will set the value to the selected layer, but if no layer >> is selected it doesn't work. If I run >> >> import nuke.rotopaint as rp >> >> rp = nuke.toNode("RotoPaint1") >> >> curvesKnob = rp['curves'] >> >> layer = curvesKnob.toElement("Layer1") >> >> >> I get access to Layer1. But how do I set a value to the rotate knob for >> example? >> >> >> Best regards, >> >> Simon >> >> >> >> >> _______________________________________________ >> 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 >> >> > > _______________________________________________ > 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 > >
_______________________________________________ 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