Question

I'm using Python-fu's gimp.pdb.gimp_paintbrush_default(layer, 2, [10,10, 20,20]), but no matter how many strokes I tell it to paint, it only ever paints the first (x,y) (in this case, (10,10)). Is it expecting a different format? The documentation for the function isn't for the Python plugin, and simply says that the third parameter expects a variable of type FLOATARRAY. I assume the Python version uses a list here, but it doesn't seem to look ahead to any values after the first two. How can I get it to paint more than one control point?

Was it helpful?

Solution

The second parameter you pass - in this case "2" indicates to GIMP the length of the list in the following parameter - although, when coding in Python we are used that the called function don't have a problem finding the length of a list, these calls in GIMP Python scripting are a 1:1 mapping to the GIMP API for several other languages, and are written in C.

In C there is no way for one to know the length of an array passed, unless it is explicitly passed, so, there is the need for this parameter.

Try doing this instead:

points =  [10,10, 20,20]
pdb.gimp_paintbrush_default(layer, len(points), points)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top