Gimp 2.99/ Python3 Stuck with map-object plugin

I’m trying to rewrite a plugin for GIMP 2.99 and I’m trying to implement
plug-in-map-object.
I have an image, create a copy to work with ‘new_image’, merge all layers…
I’m stuck at the point where to define the layer(s) to pass to the plug-in (line 74).

config.set_property('drawables', layerstack[0])  # todo GimpObjectArray, The input drawables

It expects a GimpObjectArray. How do I obtain that?
If I try layerstack[0] it tells me:

 TypeError: could not convert <Gimp.Layer object at 0x7fd39dd17c00 (GimpLayer at 0x558342c8db70)>
 to type 'GimpObjectArray' when setting property 'GimpProcedureConfig-plug-in-map-object.drawables'

I can’t figure out what to put in there. It was so easy in GIMP 2.10 where it was just ‘layer’.

The complete script is here:

Any ideas?

GIMP’s own Python plug-ins can be a good source for inspiration. This is taken from file-openraster.py:

pdb_config.set_property('drawables', Gimp.ObjectArray.new(Gimp.Drawable, [drawable], False))

1 Like

To add to that, the various box-*-drawable and cyl-*-drawable parameters you have need to be set to None rather than 0 because Drawables are objects and not int IDs in 3.0.

Or, you can leave them off entirely now. :slight_smile:

Thank you, that worked.

Thank you.
Yes, I thought it might be wrong.
Working now.