Copy link to clipboard
Copied
I wrote a script but it only works with Anchor Point, Position, Rotation,...
How to delete all keyframes of all properties of a layer?
Can someone give me an example, thank you very much
var activeComp = app.project.activeItem;
var selectedLayer = activeComp.selectedLayers[0];
for (var i = selectedLayer.property("Transform").numProperties; i >= 1; i--) {
var prop = selectedLayer.property("Transform").property(i);
for (var j = prop.numKeys; j > 0; j--) {
prop.removeKey(j);
}
}
You need a recursive property sniffer. Try this:
function processProperty(theProp){
if (theProp.propertyType == PropertyType.PROPERTY){
for (var j = theProp.numKeys; j > 0; j--){
theProp.removeKey(j);
}
}else{ // must be a group
for (var i = 1; i <= theProp.numProperties; i++){
processProperty(theProp.property(i));
}
}
}
var myLayer = app.project.activeItem.selectedLayers[0];
processProperty(myLayer);
Copy link to clipboard
Copied
You need a recursive property sniffer. Try this:
function processProperty(theProp){
if (theProp.propertyType == PropertyType.PROPERTY){
for (var j = theProp.numKeys; j > 0; j--){
theProp.removeKey(j);
}
}else{ // must be a group
for (var i = 1; i <= theProp.numProperties; i++){
processProperty(theProp.property(i));
}
}
}
var myLayer = app.project.activeItem.selectedLayers[0];
processProperty(myLayer);
Copy link to clipboard
Copied
thank you