Collected keyframes list is empty for all properties except for position is has values

Explorer ,
Feb 12, 2022 Feb 12, 2022

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'm cycling through all the properties of my layers. I'm trying to copy keyframes for each property into a list.

The issue now, is that only position property returns values into the list, other properties such as scale and other properties return an empty list.

I'm wondering what's about this function, why it's not returning data for other properties than position.

function collectKeyframes(propertyInput)
    {
            if(propertyInput instanceof Property)
                {
                        var totalKeys, prop, keyIndexList, curKeyIndex, curKeyValue, inin, outin, ab, cb, ie, oe, sab, scb, ist, ost, rov, twoDS, threeDS;
                        twoDS= PropertyValueType.TwoD_SPATIAL;
                        threeDS = PropertyValueType.ThreeD_SPATIAL;

                        keyIndexList = new Array();
                        totalKeys = propertyInput.numKeys;
                        if(totalKeys > 0)
                                {
                                    for(var i = 1; i<= totalKeys; i++)
                                        { 
                                                curKeyTime = propertyInput.keyTime(i);
                                                curKeyTime= curKeyTime+1;
                                                curKeyIndex = i;
                                                curKeyValue = propertyInput.keyValue(i);
                                                inin = propertyInput.keyInInterpolationType(curKeyIndex);
                                                outin = propertyInput.keyOutInterpolationType(curKeyIndex);
                                                
                                                if(inin == KeyframeInterpolationType.BEZIER && outin == KeyframeInterpolationType.BEZIER)
                                                    { 
                                                        ab = propertyInput.keyTemporalAutoBezier(curKeyIndex); 
                                                        cb = propertyInput.keyTemporalContinuous(curKeyIndex);
                                                    } 
                                                if(inin != KeyframeInterpolationType.HOLD || outin != KeyframeInterpolationType.HOLD)
                                                    {
                                                        ie = propertyInput.keyInTemporalEase(curKeyIndex); 
                                                        oe = propertyInput.keyOutTemporalEase(curKeyIndex);
                                                    }
                                                if(propertyInput.propertyValueType == twoDS || propertyInput.propertyValueType == threeDS)
                                                    { 
                                                        sab = propertyInput.keySpatialAutoBezier(curKeyIndex);
                                                        scb = propertyInput.keySpatialContinuous(curKeyIndex);
                                                        ist = propertyInput.keyInSpatialTangent(curKeyIndex);
                                                        ost = propertyInput.keyOutSpatialTangent(curKeyIndex);
                                                        rov = propertyInput.keyRoving(curKeyIndex);
                                                        keyIndexList [keyIndexList.length] = {'curKeyTime': curKeyTime, 'curKeyIndex':curKeyIndex , 'curKeyValue':curKeyValue , 'inin':inin , 'outin':outin , 'ab':ab , 'cb':cb , 'ie':ie , 'sab':sab, 'scb':scb, 'ist':ist, 'ost':ost, 'rov':rov}
                                                    }
                                            }
                                        alert (keyIndexList);
                                        return (keyIndexList);
                                }
                        else
                                {
                                        return null;
                                    }
            }                
}

 

Thanks in advance.

TOPICS
Error or problem , Expressions , Scripting

Views

34

Likes

Translate

Translate

Report

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

Enthusiast , Feb 12, 2022 Feb 12, 2022
Seems like you're only storing values for TwoD_SPATIAL and ThreeD_SPATIAL. Only properties like Position and Anchor Point are spatial properties that have both spatial (controlling ease between keyframes in space) and temporal (controlling ease between keyframes in time) handles.https://ae-scripting.docsforadobe.dev/properties/property.html?highlight=propertyValuetype#property-propertyvaluetype

Likes

Translate

Translate
Enthusiast ,
Feb 12, 2022 Feb 12, 2022

Copy link to clipboard

Copied

LATEST

Seems like you're only storing values for TwoD_SPATIAL and ThreeD_SPATIAL. Only properties like Position and Anchor Point are spatial properties that have both spatial (controlling ease between keyframes in space) and temporal (controlling ease between keyframes in time) handles.

https://ae-scripting.docsforadobe.dev/properties/property.html?highlight=propertyValuetype#property-...

Likes

Translate

Translate

Report

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