GIMP 2.99/Python How to use add_bevel

I’m at 00753ef now.

Trying to use add_bevel in a python script.
This one worked until last week.

        procedure = Gimp.get_pdb().lookup_procedure('script-fu-add-bevel')
        config = procedure.create_config()
        config.set_property('run-mode', Gimp.RunMode.NONINTERACTIVE)
        config.set_property('image', img_ecke_1)
        # config.set_property('num-drawables', 1)
        config.set_property('drawables', Gimp.ObjectArray.new(Gimp.Drawable, [drawable_1], False))
        config.set_property('adjustment', 30)
        config.set_property('toggle', False)
        config.set_property('toggle-2', False)
        result = procedure.run(config)
        success = result.index

already found that it does no longer need num-drawables.
But it complains about the drawables parameter:

config.set_property('drawables', Gimp.ObjectArray.new(Gimp.Drawable, [drawable_1], False))
                                     ^^^^^^^^^^^^^^^^
AttributeError: 'gi.repository.Gimp' object has no attribute 'ObjectArray'

So how is it supposed to be written now?

It’s now just a NULL-terminated C-array, which in Python basically just means a list. In other words:

        config.set_property('drawables', [drawable_1])

:smile:

Ah wait, no sorry. Wait a sec.

Ok so the syntax I proposed earlier was the expected one and what we were aiming for. Unfortunately it doesn’t work for bindings (or at the very least, for pygobject, the Python binding), because GObject-Introspection misses some annotations (or I haven’t found them through docs) so pygobject just doesn’t realize how to transform a list of drawables into a NULL-terminated C array.

As a consequence, I just created a wrapper function specifically for core object arrays (i.e. lists of images, of items, of resources…) and the new functions are:

# To set a list of drawables:
config.set_core_object_array('drawables', [drawable1])
# To get a list of drawables:
drawables = config.get_core_object_array('drawables')

For other types, continue using the generic config.set|get_property() for these arrays, until GObject Introspection gets enhanced or that someone steps up to tell us how to do it (if it can already be done), you’ll have to use these dedicated functions.

I’ve just triggered once again a nightly flatpak build. I assume you can update in a few hours or so.

Thank you.
That works now.