Re: [Gimp-developer] Of Palettes and Plug-ins



On Fri, Sep 6, 2013 at 1:16 PM, Joao S. O. Bueno <gwidion mpc com br> wrote:

Besides  - you have to check what makes more sense - I't think Palette
exporting/importing plug-ins have to be on the Palletes context menu

My basic design is going to be as follows:

   - Add a procedure to register a palette loader

There is no such thing as a "palette loader" - but there are plug-ins that
are registered under thhe "Palette" context menu. Ther is a sub-menu
named "Export as..." -
I think a loader should be under <palette>/Import/<title>"


I would like to be able to follow the normal flow to importing a palette
from a file like selecting "Import palette..." from the Palettes menu. Then
click on the Palette file option. Then select the file. Click "Open", and
it imports.

I don't want to have to add a menu option for each plugin that I add that
can read a palette.

I also don't want each palette import plugin to have to write code to
create a palette (in the gimp UI). I would rather be able to pass back some
kind of palette object (like maybe a list of colors) and have the code
within gimp to write that data into the palette within the gimp ui.

   This procedure will check that registered procedure take an int32 and
   two strings and return a palette. The args are the same as those for the
   image importer, and the return is a palette instead of an image.
If it is a Python script, maybe you  prefer using "PF_FILE" instead
of a string - that allows you to programatically pass a  file path,
but the automatic
Python-fu interface would open a nice file dialog to use your plug-in
directly.


Hmm. I see now that the Python-fu tries to do some UI magic. Is there some
way to bypass that and write a plugin that allows passing in the parameters
instead.

   - Write a python (or other language) procedure to implement that
   interface.
Python recomended - some of the options in the Pallete context menu
are already in Python, copy one of them and it will be easier for you
to make your own.


As mentioned above, I am interested in improving the Gimp infrastructure
such that palette loaders can be implemented in a similar manner to file
loaders.


And finally -as noted in the other e-mail I sent: the returend
"PF_PALETTE" is a string, but
a string corresponding to a unique name palette in GIMP, which is used
as ID for all Palette related
PDB calls.


I haven't found any way to make that interface work for what I am doing.
Basically, I need to be able to return a palette object, but not one in the
UI yet. That palette object can then be loaded by the existing gimp code
into a new palette in the UI. Note that this is a slightly simplified
description as all the current palette "loaders" return a GList* with only
one entry to a palette object. This code is
here<https://github.com/GNOME/gimp/blob/master/app/core/gimppalette-import.c#L492>
.

Thanks for the help,
wt


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