-
Delete Selected Keyframes via script
Hi all
I am writing a script to remove keyframes from selected properties and layers.with this code (below) AE deletes the selected keyframes form the first selected property from the first selected Layer good until then :D.
var keySelection = property.selectedKeys;
for (i = 0; i < keySelection.length; i++) {
property.removeKey(keySelection[i]-i);}
As i said, it deletes the selected keys from the first property after that, looks like the selection goes to hell and is like nothing was selected in the fist place, so It can’t move to the next selected property to continue deleting frames.
here is the complete code I have:
var layers = comp.selectedLayers;
var properties = comp.selectedProperties;for (var j = 0; j < layers.length; j++) {
for (var k = 0; k < properties.length; k++) {if (properties[k] instanceof Property){
var keySelection = property.selectedKeys;
for (var i = 0; i < keySelection.length; i++) {
property.removeKey(keySelection[i]-i); }
}
}
}any help, suggestion or advice is welcome