Re: calling script-fu from perl script

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

 



On Sat, Sep 09, 2000 at 11:18:49AM -0500, "Michael J. Hammel" <mjhammel@xxxxxxxxxxxxxxxxx> wrote:

Thanks for the reply ;) I posted it to gimp-developer because i seems this
is a generic gimp bug and hope somebody else can add more.

> gimp.  I suspect (but it's a guess) that the second one causes a change to the
> drawable id's for the image (which starts with a single layer when
> old_photo gets to it).

If the script-fu-drop-sahdow does change the darwable id (creates a new
one and deleted the old one) then your code is buggy: you simply mustn't
call gimp functiosn on drawables that do not exist. In this case this
would also be a gimp-bug, however, since gimp is not supposed to crash
when you feed it nonexistant drawable id's.

> If this is the problem, perhaps setting a delay of some kind between the
> two would work. 

No, it wouldn't. A delay wouldn't change the drawable id. A delay would
help if script-fu would return to the gimp before it finished its work
(unlikely, but definitely not impossible), or gimp would do something
after it has forwared the results to perl.

> script_fu_drop_shadow(
>         INT32 run_mode=1        "Interactive, non-interactive"
>         IMAGE image=-1  "Image"
>         DRAWABLE drawable=2     "Drawable"
> 
> Without the sleep() call, the last entry looks like this:
> 
> script_fu_drop_shadow(
>         INT32 run_mode=1        "Interactive, non-interactive"
>         IMAGE image=0   "Image"
>         DRAWABLE drawable=2     "Drawable"

> Looks like the image id gets changed somehow.  Ideas?

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, croak_str));

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.

Here I have to give up and hope this rings a bell for somebody more tied
to the internals of gimp id management.

-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg@xxxxxxxxxxxxx |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux