RSS/Atom feed Twitter
Site is read-only, email is disabled

undoo history and automatic script creation

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

6 of 6 messages available
Toggle history

Please log in to manage your subscriptions.

undoo history and automatic script creation Emile Snyder 05 Oct 00:37
undoo history and automatic script creation Saul Goode 05 Oct 01:24
  undoo history and automatic script creation Michael Schumacher 05 Oct 01:32
   undoo history and automatic script creation Emile Snyder 05 Oct 04:37
undoo history and automatic script creation Saul Goode 05 Oct 03:07
  undoo history and automatic script creation Sven Neumann 05 Oct 08:01
Emile Snyder
2006-10-05 00:37:54 UTC (over 17 years ago)

undoo history and automatic script creation

Hi all,

I was playing around with gimp python scripting recently and it struck me that (being a naive newbie to the code, take with grain of salt, etc.) the undo history should be reasonably straightforward to automatically translate into a python/script-fu program.

Am I missing something about why this is hard to do, or has it just never been a priority to provide "record to script" capability?

Do you real gimp hackers have any tips or gotchas to look out for if I wanted to play around with attempting such a thing?

thanks, -emile

Saul Goode
2006-10-05 01:24:14 UTC (over 17 years ago)

undoo history and automatic script creation

Am I missing something about why this is hard to do, or has it just never been a priority to provide "record to script" capability?

If my understanding is correct, the UNDO history does not record the actions you take, merely the result of those actions (by saving the portions of the image that were modified. The difficulty of providing a "record to script" functionality (AKA macro recorder) is that you would have to maintain a record of the specific actions taken (otherwise your recorded script would not work on a different image).

A macro recorder would basically have to be a different implementation than the UNDO history. I imagine certain simple actions (such as changing the opacity of a layer, select->none, etc) are already recorded in the UNDO history as "actions" and you might examine how those are handled if you are interested in implementing a macro recorder.

-------- "It is amazing what you can accomplish if you do not care who gets the credit." -- Harry S. Truman

Michael Schumacher
2006-10-05 01:32:51 UTC (over 17 years ago)

undoo history and automatic script creation

Saul Goode wrote:

Am I missing something about why this is hard to do, or has it just never been a priority to provide "record to script" capability?

A macro recorder would basically have to be a different implementation than the UNDO history. I imagine certain simple actions (such as changing the opacity of a layer, select->none, etc) are already recorded in the UNDO history as "actions" and you might examine how those are handled if you are interested in implementing a macro recorder.

There is an enhancement request about a script/macro recoder with several good entries describing possible approaches and the respective problems:

http://bugzilla.gnome.org/show_bug.cgi?id=51937

HTH, Michael

Saul Goode
2006-10-05 03:07:28 UTC (over 17 years ago)

undoo history and automatic script creation

On a related note to this thread, I was wondering if there was any way to have a script "perform" an Undo or to go back a few steps in the Undo history.

I have a script which chops a layer up into multiple pieces and the result is a layer that is centered relative to the original layer. In many situations, it would be desirable to have the generated layer aligned to the corners of the original layer. I had considered performing the additional alignment steps and then the user could perform UNDOs until he achieved the alignment he desired, but this would make it very tedious (and unintuitive) to perform an actual UNDO.

However, if I could perform the four alignments in the script and subsequently set the UNDO history back to the "centered" result, then the user could perform REDOs to attain his alignment while retaining the intuitive, one-step UNDO (or alternately, just continue with his editing).

I am unaware of any PDB function that would permit and would be interested in any input as to how this might be accomplished -- including which code in the core I might avail if I were to create such a PDB function.

--------
"It is amazing what you can accomplish if you do not care who gets the credit." -- Harry S. Truman

Emile Snyder
2006-10-05 04:37:36 UTC (over 17 years ago)

undoo history and automatic script creation

On Thu, 2006-10-05 at 01:32 +0200, Michael Schumacher wrote:

Saul Goode wrote:

A macro recorder would basically have to be a different implementation than the UNDO history. I imagine certain simple actions (such as changing the opacity of a layer, select->none, etc) are already recorded in the UNDO history as "actions" and you might examine how those are handled if you are interested in implementing a macro recorder.

Ahh, guess I should have dug a little deeper before mouthing off ;)

There is an enhancement request about a script/macro recoder with several good entries describing possible approaches and the respective problems:

http://bugzilla.gnome.org/show_bug.cgi?id=51937

Thanks, I'll check it out.

-emile

Sven Neumann
2006-10-05 08:01:44 UTC (over 17 years ago)

undoo history and automatic script creation

Hi,

On Wed, 2006-10-04 at 18:07 -0700, Saul Goode wrote:

I am unaware of any PDB function that would permit and would be interested in any input as to how this might be accomplished -- including which code in the core I might avail if I were to create such a PDB function.

The undo functionality is intentionally not exported to the PDB because it would be too easy for scripts and plug-ins to mess with the fragile internals of it then. What you described as a possible use case seems to be a very special case and I expect that anyone but the script author himself would only find it confusing.

Sven