Add new a pencil object in a roto node with python

The documentation details the ways to create different types of objects:

Beziers = app.Roto1.roto.createBezier(x,y,time)
Ellipses = app.Roto1.roto.createEllipse(x, y, diameter, fromCenter, time)
Rectangle = app.Roto1.roto.createRectangle(x, y, size, time)

but I couldn’t find a way to create a new pencil object. I already tried with createPencil, but it doesn’t work. What is the way to create this object?

There isn’t a function like the others to create Pencil, Brush, or Eraser objects.

What I do instead is create a new Pencil1 object in the GUI and then add points to it using the following syntax:

app.Roto1.roto.Layer1.Pencil1.addControlPoint(x, y)

The ‘createStroke’ function is declared in the program’s source code (file:Natron/Engine/PyRoto.cpp), but it is not recognized in the scriptEditor and its parameters are not the same as the others.

Mr. Kepzie (Alexandre) worked on that part of the code but it has been inactive for a long time. :frowning:

Does it mean that the function exists but is broken?

I didn’t find that function again when reviewing the file (?), but it seems that pencil objects cannot be created from the Python editor.
The simplest solution is to create a file with the predefined curves and copy them manually.

1 Like