Skip to main content
Inspiring
November 5, 2015
Question

Using undo groups

  • November 5, 2015
  • 1 reply
  • 2956 views

Hi,

can I create undo groups and undo in code? Im not sure Im getting the idea of undo groups right. Can I "use" them ("undo") only in the AE or also script the "undo" action itself somehow?

AW

This topic has been closed for replies.

1 reply

Mathias Moehl
Community Expert
Community Expert
November 5, 2015

The idea of undo groups is that if your script performs a lot of changes in the AE project, that the user can undo them in a single step.

Say your layer manipulates the in- and out-points of 10 different layers with the click of a single button. Then the user expects that this change can be undone be just doing a single undo and not by undoing 20 times (i.e. undoing the change of each in- and outpoint separately).

Undo is only for undoing changes of the AE project, not undoing other things in your script. Example: Im my script MaskTracker+, when you move some masks based on a track, you can only this movement for all the masks in one step. But if you load new tracking data in the script, this is nothing that can be undone by undo groups (this loading the tracking data is purely internal to the script and does not affect the AE project directly).

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
tardigrade01
Inspiring
November 5, 2015

We set something up like this (sorry, I don't know how to past code correctly):

previewDynamicContent : function(data) {

  app.beginUndoGroup("Execute Our Code");
     //our code

   app.endUndoGroup();
},
undoPreviewDynamicContent: function(){

  app.executeCommand(16);
}

and assigned the undoPreviewDynamicContent function to a button.

Legend
November 5, 2015
(sorry, I don't know how to past code correctly):

For future reference you click "Use advanced editor" in the top right of the reply field, then choose the ">>" icon, "Syntax Highlighting", "javascript". What ever you have selected in your reply will  convert to JS code with syntax highlighting.