Skip to main content
Abdelkrim Ibrahim
Participating Frequently
February 11, 2022
Answered

Distinguish between a property that have animated keyframes and markers property

  • February 11, 2022
  • 1 reply
  • 401 views

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.

This topic has been closed for replies.
Correct answer Akira Endo

Hi,

did you try adding

prop.name != "Marker" 

to your if-statement?

if (prop.numKeys > 0 && prop.canVaryOverTime==true && prop.name != "Marker")

Maybe it helps.

Cheers,

Akira

1 reply

Akira EndoCorrect answer
Participating Frequently
February 11, 2022

Hi,

did you try adding

prop.name != "Marker" 

to your if-statement?

if (prop.numKeys > 0 && prop.canVaryOverTime==true && prop.name != "Marker")

Maybe it helps.

Cheers,

Akira

Abdelkrim Ibrahim
Participating Frequently
February 11, 2022

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.

 

Mathias Moehl
Community Expert
Community Expert
February 12, 2022

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.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects