First of all, a big thank you to the developers for an great image
editing program.

I am writing a python-gimp export script for an animation tool, using
Ubuntu 10.10 "maverick" with Gimp version 2.7.3 from this ubuntu PPA,
which is not a nightly build of your devel tree, but close enough:

The workflow expects a gimp document's layers to be exported as a tree
of files, where the directory structure is determined by the
document's layer groups. So, if group "panel_1" has sublayers "foo"
and "bar", and group "panel_2" has sublayers "blargh" and "foobar",
the expected output looks like this:

$ tree exported_layers
|-- panel_1
|   |-- bar.png
|   `-- foo.png
`-- panel_2
    |-- blargh.png
    `-- foobar.png

How can one get the layer objects that correspond to a given group?
It's easy to get layer IDs, it's not clear how to access the layer
object even if one knows its ID.

The gimp.image.layers sequence only contains the first-level layers
and layer groups, not all the layers. In our document, all layers
belong to a group, so that sequence only contains layer groups.

When getting the children of a given group,
"pdb.gimp_item_get_children(group)[1]" returns a tuple of IDs. Having
only each layer's ID and not the layer object means one can't, for
instance, make a new layer as a duplicate of an existing one. This
code fails with a type error:
  newlayer = pdb.gimp_layer_new_from_drawable(layerID, image)

Is there something I'm missing/doing wrong, or is this a gap in the
available script-fu methods?


Javier Candeira.
Gimp-developer mailing list

Reply via email to