Copy link to clipboard
Copied
I'm working on a script and I just finished creating a function that renders certain items and then import them into after effects.
I want to add
before the function and
after the function, so I can undo all the actions within that function that affects the project.
Everything together looks like this
Here's a screenshot of all the actions performed in that function which can be found under Edit > History
This is basically the history for 1 imported item, since the final script will do this for multiple files I need an effective way to undo all actions for all items.
The errror I get with the from after effects when pressing CTRL+Z is:
"Undo group mismatch, will attempt to fix."
Otherwise everything works completely fine without the Undo groups involved.
My goal with this is to create a scriptui button that will undo all of those actions.
If any of you know a way to make this work or perhaps having the same issue then please let me know.
When you render ur undo history is cleared for some reason and you can't undo something which happend before render.
You may need to write script that can work like below.
Before render some actions are performed and then, trigger render from script > check if rendering is complete >after render is done > perform reveresed actions.
/// Plz refer that ae scripting guide for syntax
renderAndImport_button.onClick=function(){
myActions();
app.renderQueue.render();
if(app.renderQueue.stillRendering){
sleep
...Copy link to clipboard
Copied
When you render ur undo history is cleared for some reason and you can't undo something which happend before render.
You may need to write script that can work like below.
Before render some actions are performed and then, trigger render from script > check if rendering is complete >after render is done > perform reveresed actions.
/// Plz refer that ae scripting guide for syntax
renderAndImport_button.onClick=function(){
myActions();
app.renderQueue.render();
if(app.renderQueue.stillRendering){
sleep(1 min)
}else{
myActionReversed();
}
}
// Plz refer that ae scripting guide for exact method and names
//See if this helps.
Copy link to clipboard
Copied
When you render ur undo history is cleared for some reason and you can't undo something which happend before render.
You may need to write script that can work like below.
Before render some actions are performed and then, trigger render from script > check if rendering is complete >after render is done > perform reveresed actions.
/// Plz refer that ae scripting guide for syntax
renderAndImport_button.onClick=function(){
myActions();
app.renderQueue.render();
if(app.renderQueue.stillRendering){
sleep(1 min)
}else{
myActionReversed();
}
}
// Plz refer that ae scripting guide for exact method and names
//See if this helps.
By @manjunath MK
"When you render ur undo history is cleared for some reason and you can't undo something which happend before render."
This was really useful information, thank you!
I made sure to create the Undo Group after rendering since the actions before rendering is just putting the comps into renderqueue.
I tried it out and it works flawlessly.
Copy link to clipboard
Copied
Great to know that it works in this case - yet I faced undo group misbehaving when undoing complex script builds.
Workflow:
1. Project X opened.
2. Project X appended with new elements. Project remains opened.
3. If undo is made after the 2nd step - sometimes it undo's, sometimes not.
What I tried doing is to move undogroup into different locations of the script, considering that some events might be causing the issue. By now haven't found a proper workaround.
Copy link to clipboard
Copied
Try changing undoGroup name .
Else
Unless u don't have method to do something in scripting reference don't go for app.executeCommand().
Most of the tasks can be done using clean functions using built in methods or actions, without using app.execute.
Post an example or attach an AE file with issue.Let me check once.
Copy link to clipboard
Copied
I think using different undoGroup names as manjunath recommended can potentially help.
With this you can create a history of Undo states that you can reference in your code with if statements or so