Create Bezier Points with Python

Hi all,

I would like to create a bezier node in Python.
My problem is when I try to create 4 points and interpret the shape (cusp points, smooth, ect). The rest is ok. I hope 😉

Here is what I have now:

Code:

knb = nuke.createNode("Bezier")
      nuke.knob("Bezier1.name", "Test")
      nuke.knob("Test.invert", "true")
      nuke.knob(Test.color", "0")
      nuke.knob("Test.points", "1998 232 0 0.31")
      #nuke.knob(Test.shape", "curve L x1 0")


I don’t know how I can create more that one point, and how I need to write correctly the shape curve.

I have create a .nk file to know how the bezier node is build:

Code:

Bezier {
 inputs 0
 invert true
 points {{
{-38 908 0 -2.83}
{-60 244 0 -0.32}
{1998 232 0 0.31}
{1988 908 0 2.82}
}}
 shape {{curve L x1 0}}
 center {960 540}
 color 0
 name 2_35_cache
 selected true
 xpos 239
 ypos 22
}


That’s an example but if someone can help me to transform the node code in Python…

Thx a lot

No Responses to “Create Bezier Points with Python”

Post a Comment