Lost my code, tried to reproduce it for some hours and finally manage to figure it out.

Its was weird though, you use the rotopaint to create elements and append it to the splinewarp:


import nuke.splinewarp as sw, nuke.rotopaint as rp
warpNode = nuke.createNode('SplineWarp3')
rotoNode = nuke.createNode('RotoPaint')
rotoCurve = rotoNode['curves']
warpCurve = warpNode['curves']
warpRoot = warpCurve.rootLayer
newshape = rp.Shape(rotoCurve, type="bspline")
newpoint = rp.ShapeControlPoint(500,500)
newshape.append(newpoint)
warpRoot.append(newshape)




After testing it for a while, found it to crash nuke.

But, managed to find a workaround, create the regular Rotopaint node (instead of appending directly on the splinewarp), and after that iterate the shapes on it and move them to a splinewarp node, i.e:


for shape in rotoRoot:

warpRoot.insert(0,tst)


Its working fine here, no crashes.

Hope it helps,
Magno.







Hi ! It's a good hint you found here with the Stroke object !

Unfortunately, it did not solved my problme, prehaps i have introduced a mistake while using .Stroke instead of Shape, but sometimes when we look too close at something, we don't see anymore what is obvious to other

So based on your suggestion, i am executing this :

import nuke.splinewarp as sw
warpNode = nuke.createNode('SplineWarp3')
warpCurve = warpNode['curves']
warpRoot = warpCurve.rootLayer
newshape = sw.Stroke(warpCurve, type="bspline")
newpoint = sw.AnimControlPoint(500,500)
newshape.append(newpoint)
warpRoot.append(newshape)

But now i have this error message :

File "<string>", line 5, in <module>
TypeError: can't add a Stroke object to a non-Roto knob

Were you running this code on a RotoPaint node or a SplineWarp node ?

Thanks for sharing


From: Magno Borgo <li...@borgo.tv>
To: tremblay alexandre <alexandretrembla...@yahoo.ca>; Nuke Python discussion <nuke-python@support.thefoundry.co.uk>
Sent: Monday, January 28, 2013 12:14:27 PM
Subject: Re: [Nuke-python] Create B-Spline : code fail inside Nuke7.0v1

Hi! I have been working on something alike to adapt my v6 scripts as well (not finished yet unfortunately)
When you iterate on the elements inside an existing splinewarp node, all shapes (bezier, bspline, cusp bezier)
are listed as _curveknob.Stroke instead of  _curveknob.Shapes inside the splinewarp.

<_curveknob.Stroke object at 0x10d51e620> BezierCusped1
<_curveknob.Stroke object at 0x10d51e800> Stroke4

And when you insert strokes instead of shapes, the script works:

newshape = sw.Stroke(warpCurve, type="bspline")
newpoint = sw.AnimControlPoint(500,500)
newshape.append(newpoint)
warpRoot.append(newshape)




Hi

  Before Nuke7.0v1 ( with Nuke 6.3v6 ), we were using a script to generate B-Splines with the SplineWarp node ( same code is also working  with the RotoPaint node ).
Now we have upgraded to 7.0v1, the code is failing, but only with the SplineWarp node ( works well with the RotoPaint).

This is the code :

import _curveknob
warpNode = nuke.createNode('SplineWarp3')
warpCurve = warpNode['curves']
warpRoot = warpCurve.rootLayer
newshape = _curveknob.Shape(warpCurve, type="bspline")
newpoint = _curveknob.ShapeControlPoint(500,500)
newshape.append(newpoint)
warpRoot.append(newshape)

I get this error :
File "<string>", line 7, in <module>
SystemError: internal error - no curve group associated with this shape

i have tried also to import nuke.splinewarp module instead of _curveknob, but not much sucess :

import nuke.splinewarp as sw
warpNode = nuke.createNode('SplineWarp3')
warpCurve = warpNode['curves']
warpRoot = warpCurve.rootLayer
newshape = sw.Shape(warpCurve, type="bspline")
newpoint = sw.ShapeControlPoint(500,500)
newshape.append(newpoint)
warpRoot.append(newshape)

maybe it is related with the curveType, but I can't find my answers with the docs, so i wanted to know if somebody had the same problem and found a solution about it.


Thankyou !



--
Magno Borgo
www.boundaryvfx.com
www.borgo.tv
Brasil:Curitiba:GMT= -2 (dst)





--
Magno Borgo
www.boundaryvfx.com
www.borgo.tv
Brasil:Curitiba:GMT= -2 (dst)
_______________________________________________
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

Reply via email to