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

Ofnuts <[email protected]>
Newsgroups gmane.comp.video.gimp.devel
Message-ID <[email protected]>
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:    [email protected]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.