-
Undo group problem
I’m creating a Script UI with a slider. While the user is changing the slider, a temporary shape layer is created in order to preview the effect. When they let go, the temporary layer is removed and the effect is applied.
slider1.onChanging = function() { // this will get fired 100+ times // create shape layer to preview (adjust outPoint on the shape layer) } slider1.onChange = function() { // this will get fired once // adjust selection }
Since the preview layer can get changed 100s of times in a few seconds, a clean undo group is important.
My initial thought was to start an undo group on onChanging and close it on onChange. However the script is actually firing off with each change on the slider, so this doesn’t work as expected.
My current workaround is to create an intentional undo group mismatch. This leaves the user with an annoying pop up “After Effects warning: Undo mismatch, will attempt to fix.” but it actually undos everything perfectly.
Is there a better way to go about doing this? Or some other tricks to hack the history panel?