Hi Mathias, check out one of my scripts, it should help you and it has lots of useful functions in there too.
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
Dr. Mathias Möhl
Marlow 52 , 18551 Sagard, Germany
Phone +49 (0)38302 - 88 75 61
i...@mamoworld.com