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

Distinguish between a property that have animated keyframes and markers property

Explorer ,
Feb 11, 2022 Feb 11, 2022

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.

TOPICS
Expressions , How to , Resources , Scripting
280
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

correct answers 1 Correct answer

Community Beginner , Feb 11, 2022 Feb 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

Translate
Community Beginner ,
Feb 11, 2022 Feb 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

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 ,
Feb 11, 2022 Feb 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.

 

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 ,
Feb 12, 2022 Feb 12, 2022
LATEST

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
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