> Highly interesting indeed. Now, what gimp-perl does (when you pass in a
> drawable instead of both image and drawable) is this:
>     if (sv_derived_from (sv, PKG_DRAWABLE))
>       arg->data.d_image = gimp_drawable_image_id    (unbless(sv, PKG_DRAWABLE, 
> i.e. it calls gimp_drawable_image_id (or gimp_layer_get_image_id
> etc..) to get the image, which in turn calls the the pdb function
> gimp_drawable_image without any caches. This means that, temporarily, gimp
> returns "-1" as the image id and later the correct one.

I did some more experimenting today and found that the following code

   # Apply an "old photo" look to it.  The sleep() is a delay to allow the
   # script to finish before we try to run any other plug-ins on it.
   script_fu_old_photo($drawable, 0, 1, 1, 1, 0);
   $drawable = gimp_image_get_active_layer($img);

   # Apply the Drop Shadow filter to it.
   script_fu_drop_shadow($drawable, "8", "8", "15", [0,0,0], "100.0", 1);

What this tells me is that the problem has to do with calling multiple
plug-ins from another plug-in.  Since the plug-ins run as separate
processes, the calling plug-in continues running after each call to another
plug-in.  The first called plug-in can change the make up of the image
drawables *after* the second plug-in is called.  That, understandably, is a
bad thing and unexpected results are likely.

So plug-ins which call other plug-ins - especially plug-ins that add or
delete layers from an image - need to pause for those plug-ins to complete
and then make sure they have the current active drawable for the image
being worked on before calling the next plug-in.

I don't see how you can "fix" this problem with the Gimp and maintain the
ability for interactive users to work on multiple images while plug-ins are
running.  The only possible option is to add some sort of "serialize
plug-ins" feature that can be turned on and off from within a plug-in.
Doesn't sound easy.

Michael J. Hammel                               The Graphics Muse 
[EMAIL PROTECTED]                      http://www.graphics-muse.com
Memory is a Net - Oliver Wendell Holmes, Sr.

Reply via email to