Hi, all!

First, I have to thank Sven for applying my "Script-Fu/Alpha to Logo"
patches.  The modified scripts should work well, but please tell me if
you spot something strange.  I will update the remaining scripts ASAP.

I re-discovered an old problem with these scripts: some operations on
the layers are not recorded on the undo stack.  If I am not mistaken,
these operations are:
- toggling the visibility of a layer,
- toggling its "preserve trans." flag,
- changing its opacity.
This has annoyed me a couple of times when working on some images by
hand, but now the problem is more visible with the "Alpha to Logo"
scripts that are undo-aware.

Some of these scripts set the "preserve trans." flag on the original
layer and apply some operations to it.  If you undo the operations,
you get back to the original image except that the flag is still set.
Running the same script or another script on the image can give a
different result than before, because of this flag.  Some other
scripts toggle the visibility of the layer and keep it in the final
image.  If you undo the script, you are back to the original image
except that the layer is now invisible.  This is not what you would
expect from the "undo" operation...

Here is an easy way to see the problem:
- create a new image
- paint something on the background layer
- paint something more
- make the background layer invisible
- undo
The last paint operation will be undone, but the layer is still
invisible.  This is even more annoying if you change the opacity of a
layer or toggle its "keep trans." flag instead of making it invisible,
because the difference is not always obvious and you could start some
other operations without seeing that the layer behaves differently.

One quick workaround would be to use defensive programming and insert
the following lines in all scripts:
  (gimp-layer-set-visible logo-layer TRUE)
  (gimp-layer-set-opacity logo-layer 100)
  (gimp-layer-set-preserve-trans logo-layer FALSE)
This would ensure that the current layer is in a "sane" state before
starting to process it, but this kludge does not solve the real
problem.

So I have two questions:
- Is there any reason why these three operations are not put on the
  undo stack?
- If there is no good reason for that, could someone tell me how to
  change the code so that it is possible to undo these operations?

-Raphael

Reply via email to