Hi,
Unlike ExtendScript, PremierePro Beta & UXP leave history of operations in ‘History’. This allows users to ‘Undo’. This is good!
I think it would be even better if we could do ‘beginUndoGroup() ~ endUndoGroup()’ like AfterEffects ExtendScript. What do you think?
Hi!
If you would like do or undo a group of actions, you can consider add multiple actions to compoundAction
before executing it.
Example code:
const ppro = require("premierepro");
const filterFactory = ppro.VideoFilterFactory;
const newComponent1 = await filterFactory.createComponent(
"PR.ADBE Gamma Correction"
);
const newComponent2 = await filterFactory.createComponent(
"PR.ADBE Extract"
);
// assume you have defined videoComponentChain from valid trackItem and project
let success = false;
try {
project.lockedAccess(() => {
success = project.executeTransaction((compoundAction) => {
var action1 = videoComponentChain.createInsertComponentAction(
newComponent1,
2
);
var action2 = videoComponentChain.createInsertComponentAction(
newComponent2,
2
);
compoundAction.addAction(action1);
compoundAction.addAction(action2);
}, "Add multiple effects");
});
} catch (err) {
log(`Error: ${err}`, "red");
return false;
}
By doing so, undo action will remove both added effects at the same time. [Another reason we switched to action-based setting APIs!]
Thanks for the feedback!
1 Like
Thanks for the reply.
This is a wonderful evolution!
I will try it.