On Mon, 2010-04-12 at 23:20 +0200, Avgoustinos Kadis wrote:
> Thanks Sven, very important to know that!
> How feasible are these options?
> 1. Randomly pick a value for each parameter. From what you said (that
> it depends a lot on the parameters) this wont give us the best results
> but at least we will have a preview.
> 2. Modify PDB so it can store default parameters and enter their
> values in the plug-ins (maintained in one place only)?

Sven wrote:

The latter is the only reasonable solution and it has been on the TODO
for quite a while already. But IMO it goes way beyond the scope of a
GSoC project.

Lloyd responds:

If the GSoC project was just to be a proof of concept, then you could
get the defaults for a subset of plugins, namely some Python plugins, as

1) make the patch to pygimp that allows Gimp to reimport plugins (small
patch proposed earlier on this list, search under "gimp_env_init".)

2) Python pseudo code snippet:

for each python plugin filename in the standard directories:
    __import__( filename )
    for procname in gimpfu._registered_plugins_.keys()
         params = gimpfu._registered_plugins_[procname][8]
         for param in params:
            default = param[3]

In other words, reimporting a plugin sometimes calls its register()
which creates a "private" structure in gimpfu that gives the
registration parameters, including the defaults (and a range of
reasonable values for some types of parameters.)

Sometimes means: unless the call to register() is guarded by if __name__
= "__main__" !!!  The call to register() is a declaration: the
convention should be that it NOT be guarded.  The call to register()
doesn't interact with Gimp.  (This is more discussion about the proposed

Not the way you would ultimately want to have defaults accessible, but
it might help enable a transition to a more general solution.

Gimp-developer mailing list

Reply via email to