-
SourceText TextDocument keyframes read incorrectly when layer is moved in time
I am trying to read through the sourceText keyframe values to later change a specified font which may or may not exist on those keys. This code works wonderfully before I drag the text layer left or right on the timeline. It continues to work when I move the sourceText keyframes or drag just the in/outPoint of the text layer. It’s only when I actually move the whole layer with the keys that it changes the font values of the keys even though the correct fonts show in the Comp and Character window.
For example, if I have 5 keyframes with 5 different fonts with the text layer in its default position, the keys’ font values get read correctly, but if I drag the whole text layer past where the 5th keyframe was originally, all 5 keys will read as the original font value of that 5th keyframe.
How do I make sure text layers that aren’t in their default positions have their sourceText keys read properly?
var sourceTextProps = [];
var textDocs = [];
for (var i = 0; i<textLayers.length; i++){
sourceTextProps[i]=textLayers[i].sourceText;
if (sourceTextProps[i].numKeys > 0) {
for (var keyIndex = 1; keyIndex <= sourceTextProps[i].numKeys; keyIndex++) {
textDocs.push(sourceTextProps[i].keyValue(keyIndex));
}
}
}
for (var i = 0; i<textDocs.length; i++){
alert (textDocs[i].font )
}