Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Deleting all keyframes

New Here ,
Jun 30, 2009 Jun 30, 2009

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?

TOPICS
SDK
8.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2009 Jul 01, 2009

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.

🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 02, 2009 Jul 02, 2009

Thanks, I'll give it a shot!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 26, 2013 Nov 26, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 10, 2010 Aug 10, 2010

One year later, the idea of doing the deletion backwards helped a lot over here. Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 26, 2015 Jun 26, 2015

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 26, 2015 Jun 26, 2015

i just finished a 5 year delete operation of 1000000 keyframes with the old

method...

😄

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 26, 2015 Jun 26, 2015

Hey, while you're waiting for your keys to be totally deleted, why don't you try to answer this one? 😉

https://forums.adobe.com/thread/1883844

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 04, 2016 Jul 04, 2016

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
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 02, 2019 Jul 02, 2019

I used this script from UserChangedParam and AE crashed. Anyone else having more luck? The script itself works well when run from ESTK.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 02, 2019 Jul 02, 2019

That's my bad, the script I posted is for ESTK, and it's -slow-

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2019 Jul 02, 2019
LATEST

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();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines