Re: [Gimp-developer] How to create a GimpFloatArray in Python plugin?

2020-02-19 Thread Ofnuts

On 2/19/20 9:17 PM, Lloyd Konneker via gimp-developer-list wrote:

Specifically, to pass as third arg to Gimp.PDB.gimp_pencil(layer, 4 line).
Said argument should be GimpFloatArray according to PDBBrowser.

I create a GimpValueArray to pass args to the pdb.  To create a GValue for
the third arg, I tried:

GObject.Value(Gimp.FloatArray.__gtype__, (1.0, 1.0, 1.0, 1.0)

which throws exception  Expected: Boxed.
Thrown by pygobject/gi/pygi-value.c about line 556.
At line 537, it seems like it should work if G_VALUE_HOLDS(value,
G_TYPE_ARRAY) for GimpFloatArray gtype.
My understanding is that PyGObject would then create a GArray from the
Python list of floats for the value of the GValue.

My best guess is Gimp is missing GI annotations or implementation for
GimpFloatArray.

Using Gimp 2.99, I am porting GimpFu.

There might be a related problem receiving GimpInt32Array *from* Gimp (not
*to* Gimp as above.)


You don't need to do complicated things like that in Python, just use a
Python array of floats.

 pdb.gimp_pencil(layer,6,[0.,0.,100.,100.,0.,200.])


(draws a '>')

___
gimp-developer-list mailing list
List address:gimp-developer-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list


[Gimp-developer] How to create a GimpFloatArray in Python plugin?

2020-02-19 Thread Lloyd Konneker via gimp-developer-list
Specifically, to pass as third arg to Gimp.PDB.gimp_pencil(layer, 4 line).
Said argument should be GimpFloatArray according to PDBBrowser.

I create a GimpValueArray to pass args to the pdb.  To create a GValue for
the third arg, I tried:

GObject.Value(Gimp.FloatArray.__gtype__, (1.0, 1.0, 1.0, 1.0)

which throws exception  Expected: Boxed.
Thrown by pygobject/gi/pygi-value.c about line 556.
At line 537, it seems like it should work if G_VALUE_HOLDS(value,
G_TYPE_ARRAY) for GimpFloatArray gtype.
My understanding is that PyGObject would then create a GArray from the
Python list of floats for the value of the GValue.

My best guess is Gimp is missing GI annotations or implementation for
GimpFloatArray.

Using Gimp 2.99, I am porting GimpFu.

There might be a related problem receiving GimpInt32Array *from* Gimp (not
*to* Gimp as above.)

I suppose I could try the Lua or Scheme binding.
___
gimp-developer-list mailing list
List address:gimp-developer-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list