Copy link to clipboard
Copied
Hello;
I'm trying to make a portion of a script that allows me to shift the keyframes of an animated property of layer according to a new value.
I implemented a recursive function that cycles through all the properties of a layer and add a condition to check if that property has keyframes (animated), however the issue now is that this condition doesn't exclude layers Markers.
function dumpPropTree(rootObj, nestingLevel)
{
var countProps = rootObj.numProperties;
for (var propIndex=1; propIndex <= countProps; propIndex++)
{
var prop = rootObj.property(propIndex);
if (prop.numKeys > 0 && prop.canVaryOverTime==true)
{
//var a=collectKeyframes(prop1);
//var b=transferKeyframes(prop1, a);
alert (prop.name);
}
if (prop.numProperties > 0)
dumpPropTree(prop, nestingLevel+1);
}
}
//**************************************************************************************************************************************
function shiftAllKeyFrames (t, oldDuration, newDuration)
{
var layersNum=t.numLayers;
for (var i=1; i<=layersNum; i++)
{
var currentLayer = t.layer(i);
dumpPropTree(currentLayer, 0);
}
}
if (prop.numKeys > 0 && prop.canVaryOverTime==true)
I thought that adding "canVaryOverTime" will solve this issue.
However, this condition doesn't exclude the Maker property.
I searched a lot, but I didn't find anything resourceful to this situation.
So, what should I add to exclude Markers property.
Thank you in advance.
Hi,
did you try adding
prop.name != "Marker"
to your if-statement?
Maybe it helps.
Cheers,
Akira
Copy link to clipboard
Copied
Hi,
did you try adding
prop.name != "Marker"
to your if-statement?
Maybe it helps.
Cheers,
Akira
Copy link to clipboard
Copied
Hello;
Thanks for you answer, how couldn't I think about this?
I kept fiddling around. I added "prop.canSetExpression==true" it gives me the same result and it extrudes all similar properties.
Best Regards.
Copy link to clipboard
Copied
If you go for the solution of checking the name, I recommend to use the matchName instead of the name to make sure it also works in non-English Ae versions.