Copy link to clipboard
Copied
What is the best way to delete all keyframes of a stream? Calling KeyframeSuite3()->AEGP_DeleteKeyframe for every key works, but takes quite a bit of time. I was hoping to just virtually toggle the 'stopwatch' button, but I can't seem to find the API for that.
Any ideas?
Copy link to clipboard
Copied
i don't know of a method of deleting all keyframes at once.
however the fastest way i know of is to delete the keyframes from last to first.
it's faster than deleting the first keyframe over and over because the stream's list of doesn't get shifted with each deletion.
if you do find a way to make keyframes go away in one swift operation, please post it here.
i could use that.
🙂
Copy link to clipboard
Copied
Thanks, I'll give it a shot!
Copy link to clipboard
Copied
Hi everyone!
This is a pretty old thread, but I found a simple solution, at least for removing all keyframes of a parameter.
params[paramIndex]->flags |= PF_ParamFlag_CANNOT_TIME_VARY;
ERR(suites.ParamUtilsSuite1()->PF_UpdateParamUI( in_data->effect_ref, paramIndex, params[paramIndex]));
then, in another call:
params[paramIndex]->flags &= ~PF_ParamFlag_CANNOT_TIME_VARY;
ERR(suites.ParamUtilsSuite1()->PF_UpdateParamUI( in_data->effect_ref, paramIndex, params[paramIndex]));
It works fast (almost instant!), and if someone finds somethin' similar for streams, it would be great!
Cheers,
François
Copy link to clipboard
Copied
One year later, the idea of doing the deletion backwards helped a lot over here. Thanks!
Copy link to clipboard
Copied
Hi Roy, Hi Shachar,
I finally got a way:
select the keys (I went the script way, much much easier!) and execute command 21 (delete).
for the record, here's my script (mask outline keys here):
string myScript = "myLayer = activeItem.selectedLayers[0]"; //I call the script on parameter change, so I'm sure the selected layer is mine, do differently if it's not the case!!
myScript.append("myMask = myLayer.Masks.property(");
myScript.append(numConvert(myMaskIndex)); // feed the script with my mask index. NumConvert() is just a way to turn a A_long to a string...
myScript.append(");if (myMask.numKeys){myMask.selected = true;app.executeCommand(21);}"); // check if my mask have keyframes, otherwise it will delete my mask!!
ERR(suites.UtilitySuite5()->AEGP_ExecuteScript( plugID, myScript.c_str(), FALSE, NULL, NULL)); // run the script
Pfffew!! Only 6 years to answer a so simple question for a so usefull function... Programming for AE is fun 😉
Cheers,
François
Copy link to clipboard
Copied
i just finished a 5 year delete operation of 1000000 keyframes with the old
method...
😄
Copy link to clipboard
Copied
Hey, while you're waiting for your keys to be totally deleted, why don't you try to answer this one? 😉
Copy link to clipboard
Copied
var targetComp = app.project.activeItem; // Collect the active composition
var selectedLayer = targetComp.selectedLayers; // Collect the selected layers
var targetParam = selectedLayer[0].transform.position; // Identify the target parameter
// Delete Keyframes forward
while (targetParam.numKeys != 0) { // While there are still Keyframes, continue looping
targetParam.removeKey(1); // Delete the first Keyframe
}
// Delete Keyframes backward
for (i = targetParam.numKeys; i != 0; i--) { // Cycle through the Keyframes
targetParam.removeKey(i); // Remove the current Keyframe
}
Copy link to clipboard
Copied
I used this script from UserChangedParam and AE crashed. Anyone else having more luck? The script itself works well when run from ESTK.
Copy link to clipboard
Copied
That's my bad, the script I posted is for ESTK, and it's -slow-
Copy link to clipboard
Copied
Wish there was a way to enable/disable time-varying (like clicking the stopwatch icon). Not ideal, but this gets the job done in ExtendScript:
// Remove all keyframes from property
app.beginUndoGroup('Remove all Keyframes from Property');
var prop = app.project.activeItem.selectedProperties[0];
var numKeys = prop.numKeys;
for (var i = numKeys; i > 0; i--) {
prop.removeKey(i);
}
app.endUndoGroup();
Find more inspiration, events, and resources on the new Adobe Community
Explore Now