Activating actions through the PDB
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
Activating actions through the PDB | David Gowers | 02 Apr 05:51 |
Activating actions through the PDB | Sven Neumann | 02 Apr 08:27 |
Activating actions through the PDB | David Gowers | 02 Apr 08:58 |
Activating actions through the PDB
I've been talking to a few people about the future of GIMP plugins,
and worked out that in terms of current plugins, there will end up
being two types:
Those that are related to GEGL (implementing GEGL operations,
modifying graphs, applying graphs) and those that are not (convenience
plugins that don't modify the image state directly, such as my plugin
to set FG to the average of FG+BG, plugins to generate resources like
brushes patterns palettes or gradients, plugins to analyze the image,
etc..)
This second class is really all I can see traditional plugins needing
to do after GEGLification is complete and stable. Ie. the first class
of plugins wouldn't need to use the PDB at all, probably.
Do you agree with this idea?
In that case, it makes sense that a plug-in would mainly provide
actions. It is also useful to be able to trigger other actions, since
many things aren't accessible through the PDB yet, only as actions.
(for example, I would like to make a plugin that creates an additional
display, zooms it to 200% and then shrink wraps it, so I have a
'working area' and a 'real size' view.)
Currently, I have to use xdotool to fake the input events required to
select the appropriate menu items, in order to implement my 'two
displays' action described above.
What would work a lot better, is something like the following:
display = pdb.gimp_display_new (image) pdb.gimp_action_run ('view-zoom-2-1', display, 0) pdb.gimp_action_run ('view-shrink-wrap', display, 0)
What do you people think of this? Is it worth pursuing, or would PDB functions for every action be easier achieved? I'm certainly prepared to work on either.
(incidentally, it may be relevant to this that I have made an extension 'GPixMint' which hosts quick actions like these so they can run a lot faster than the typical 'run an entire executable each time the function is called' plugin, and plenty of actions for it)
Activating actions through the PDB
Hi,
On Wed, 2008-04-02 at 14:21 +1030, David Gowers wrote:
This second class is really all I can see traditional plugins needing to do after GEGLification is complete and stable. Ie. the first class of plugins wouldn't need to use the PDB at all, probably. Do you agree with this idea?
Absolutely not. The GEGL API is not sufficient for this class of plug-ins as plug-ins will still need access to GIMP objects such as layers and masks and whatever else. There are associated GEGL nodes for these objects, but that is by no means sufficient.
In that case, it makes sense that a plug-in would mainly provide actions. It is also useful to be able to trigger other actions, since many things aren't accessible through the PDB yet, only as actions. (for example, I would like to make a plugin that creates an additional display, zooms it to 200% and then shrink wraps it, so I have a 'working area' and a 'real size' view.)
This is intentional. The PDB doesn't provide access to the GIMP user interface. Scripts and plug-ins are supposed to in non-interactive mode as well. What you are asking for is completely outside the realm of the PDB and it is not going to be added there, ever. If we really want to expose such user interface functionality to scripts, then we will need a different scripting API for it.
Sven
Activating actions through the PDB
Hi Sven,
On Wed, Apr 2, 2008 at 4:57 PM, Sven Neumann wrote:
Hi,
On Wed, 2008-04-02 at 14:21 +1030, David Gowers wrote:
> This second class is really all I can see traditional plugins needing > to do after GEGLification is complete and stable. Ie. the first class > of plugins wouldn't need to use the PDB at all, probably. > Do you agree with this idea?
Absolutely not. The GEGL API is not sufficient for this class of plug-ins as plug-ins will still need access to GIMP objects such as layers and masks and whatever else. There are associated GEGL nodes for these objects, but that is by no means sufficient.
Oh.. of course. Sorry, I was thinking about things like gradient-map, normalize, and tile. More complex things like warp, gimpressionist, or sample colorize didn't occur to me..
In that case, it makes sense that a plug-in would mainly provide
> actions. It is also useful to be able to trigger other actions, since > many things aren't accessible through the PDB yet, only as actions. > (for example, I would like to make a plugin that creates an additional > display, zooms it to 200% and then shrink wraps it, so I have a > 'working area' and a 'real size' view.)
This is intentional. The PDB doesn't provide access to the GIMP user interface. Scripts and plug-ins are supposed to in non-interactive mode as well. What you are asking for is completely outside the realm of the PDB and it is not going to be added there, ever. If we really want to expose such user interface functionality to scripts, then we will need a different scripting API for it.
Sven
Okay. The kind of plug-ins I'm talking about are also too lightweight for the current framework -- it's best if they run quickly -- and my current workaround can run them quickly (20 times / second for the average one). Truthfully UI manipulation doesn't fit in that area, almost everything is either about a quick manipulation on the image (vector-smooth a binary selection, colorize a greyscale, 'apply' a layer) or a quick change to the context (interpolate colors, colorize a brush, sieve a brush). I really think there is a place for this type of simple 'macro' host. Hopefully I can get it into releasable state soon. I'll just have to hack around the rest.)
Thanks for your time.