On Mon, Feb 7, 2011 at 8:44 PM,
> Quoting Javier Candeira <jav...@candeira.com>:
>> On Mon, Feb 7, 2011 at 2:30 AM,
>> <saulgo...@flashingtwelve.brickfilms.com> wrote:
>>> The PDB functions already exist for handling layer groups, and
>>> Script-fu does not have any problem making use of these functions. The
>>> Python-fu extension has not yet been updated to handle groups (there
>>> is no 'group' class).
>> Do you mean that the Python-fu extension doesn't yet have access to
>> the proper script-fu functions from pdb?
> Not exactly. In Python, a "layer" is a reference to a data structure (in C
> terminology, a pointer to a struct). One of the fields is the layer's ID
> number. The PDB only deals with these ID numbers, and Python doesn't provide
> a direct way to handle IDs. The only thing you could do is get a list of all
> layers/groups (which would be a list of pointers to structures) and search
> that list for the structure containing the appropriate ID. Since the
> 'gimp-image-get-layers' procedure now only returns the IDs of the top-level
> layers/groups, there is no way to perform such a search. At some point, this
> will be remedied but to my knowledge there is currently no way to do what
> you want with Python.
> Script-fu does not encounter this problem because there is no Script-fu data
> structure for a layer -- a layer is identified by the same ID number that
> the PDB uses. It does not matter that the "layer" IDs returned by
> 'gimp-image-get-layers' might actually be "group" IDs, to Script-fu it is
> just a number. Script-fu can pass that same number back to the PDB and the
> procedure will know what to do with it (for example, a call to
> 'gimp-item-is-group ID-number' will inform Script-fu that the ID belongs to
> a group object).
Thank you, thank you so much. You may have saved my bacon already,
just with this explanation. The rest is (very good) gravy. Back to the
code grindstone now...
Gimp-developer mailing list