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



A small example, also shows the problem, with a slightly different error
message:

   args = Gimp.ValueArray.new(4)
    args.insert(0, GObject.Value(Gimp.RunMode, Gimp.RunMode.NONINTERACTIVE))
    args.insert(1, GObject.Value(Gimp.Drawable.__gtype__, drawable))
    args.insert(2, GObject.Value(GObject.TYPE_INT, 4))
    # There is no GObject.TYPE_ARRAY
    #args.insert(3, GObject.Value(GObject.TYPE_ARRAY, (100.0, 100.0, 100.0,
100.0)))
    args.insert(3, GObject.Value(Gimp.FloatArray.__gtype__, (100.0, 100.0,
100.0, 100.0)))
    img = Gimp.get_pdb().run_procedure('gimp-pencil', args)

and get:
    File
"/work/.home/.config/GIMP/2.99/plug-ins/test_float_array/test_float_array.py",
line 28, in foo
    args.insert(3, GObject.Value(Gimp.FloatArray.__gtype__, (100.0, 100.0,
100.0, 100.0)))
  File "/usr/lib/python3/dist-packages/gi/overrides/GObject.py", line 210,
in __init__
    self.set_value(py_value)
  File "/usr/lib/python3/dist-packages/gi/overrides/GObject.py", line 266,
in set_value
    _gi._gvalue_set(self, py_value)
TypeError: Expected Boxed


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]