[Gimp-user] Undo a Step in Python-Fu



Hi there,


I've just started the task of re-writing all of my scripts in a more
professional manner. Hand-made UI, ability to be imported as a module, etc.
However, I've come across a problem with managing the plugins' undo groups.

Initially, I put the whole plugin inside of a single undo group, but this would
mean you could have a massive multiple-gigabyte undo group if the user ran the
functions a lot. I've now frozen the undo group for actions such as temporary
Previewing, but the main function has to be in an undo group.

My the current plugin I'm working on operates as such:
-The 'Preview' function shows the black&white threshold that the bloom plugin
will count as a 'light area'. The preview layer is removed whenever the next
action (running main function, previewing again, closing window) is done. This
operation will thus never be a part of the final result, and I can freeze it out
of the undo-groups.

-The 'Execute' function runs the main script (bloom in this case) *without*
closing the window. This allows the user to re-adjust the settings and
re-execute very easily. Obviously, this is in an undo-group since it'll be the
final result. However, due to the possibility of executing multiple times, it
can either A: Creates a lot of undo groups or B: One undo group with a bunch of
redundant information depending on where I place the groupings.
I've attached the .py file to this post in case you want to see the problem in
GIMP first-hand.


TL;DR:   I need a way to either go back an undo step (Ctrl-Z) or to clear an
undo step from the list in my Python script.

Attachments:
* http://www.gimpusers.com/system/attachments/303/original/fsw-bloom.py

-- 
FierySwordswoman (via www.gimpusers.com/forums)


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