Thank you, Magno and Carl! From your example, Magno, I figured out that the last layer.setTransform(transform) in my code is not necessary and without it it works fine. I thought what I get from layer.getTransform() is independent of the layer and needs to be reapplied to take effect. As it turns out, it is not. I have no idea why it fails if I try to set the transform explicitly, but if I skip it, it works fine.
Your selection code works perfectly, Carl. But I will also think about the UI idea - I like it, since it is more explicitly visible what is happening. Cheers, Mathias On 31 Jan 2014, at 16:52, Magno Borgo <[email protected]> wrote: > Hi Mathias, check out one of my scripts, it should help you and it has lots > of useful functions in there too. > > https://github.com/magnoborgo/RotoPaintToSplineWarp2 > > Its possible to check the selected layer on the UI, but from my experience > its not that reliable. > It will be easier if you create an interface (pull down menu?) for the user > select the layer from there. > > Magno. > > > > > > Hi everyone, > > how can I write values in the extra matrix of the transform of a roto or > rotopaint node? > > I first tried to write it to the array knob which is showing the value. But > this does not work, as the array knob just shows the values that actually > live in the layers of the curves knob. Changes on the array knob don’t seem > to be propagated to the actual curves. > > Hence, in a second attempt I tried to write the data as follows: > > curves = rotoPaintNode['curves'] > layer = curves.rootLayer > transform = layer.getTransform() > for i in range(0,4): > for j in range(0,4): > ac = transform.getExtraMatrixAnimCurve(i, j) > ac.removeAllKeys() > for (time,value) in animations[4*i+j]: > ac.addKey(time,value) > transform.setExtraMatrixAnimCurve(i, j, ac) > > ## here transform.getExtraMatrixAnimCurve(0,0).getNumberOfKeys() has all the > keys I’ve set > layer.setTransform(transform) > ## here layer.getTransform().getExtraMatrixAnimCurve(0,0).getNumberOfKeys() > has 0 keys... > > As you can see from the comments, I can generate the AnimCTransform object > for the curve, but when I try to apply it with setTransform, nothing seems to > happen (no error message - the data I wrote is simply not there). > > Any idea what goes wrong? > > Extra question: > For my application, the user also needs to choose to which layer(s) the > matrix data is written. Is there any way to check which layers are selected? > > Thanks a lot for the help! > Mathias > > > mamoworld.com > simplify your cgi > Dr. Mathias Möhl > Marlow 52 , 18551 Sagard, Germany > Phone +49 (0)38302 - 88 75 61 > [email protected] > > > > > > -- > Magno Borgo > Certified Nuke Trainer > www.boundaryvfx.com > www.borgo.tv > Brasil:Curitiba:GMT= -3 mamoworld.com simplify your cgi Dr. Mathias Möhl Marlow 52 , 18551 Sagard, Germany Phone +49 (0)38302 - 88 75 61 [email protected]
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
