-
keyValue() for time remapping?
Hi team,
I got a complex project that needs to go from 30fps to 23.976 fps. As part of that, I’m trying to get all keyframes, including Time Remapping keyframes, to sit on their exact frame, not in-between two frames, as sometimes happens.I found this free script, Nudge Keyframes, by Anders Sunstedt:
https://sundstedt.se/blog/?p=661It works great for Position, Rotation, Scale etc, but not Time Remapping. Is it possible for me to modify this to address Time Remapping as well?
Here’s an excerpt from the .jsx, where the position keyframes are being nudged:
or (var j = 1; j <= myLayers[i].position.numKeys; j++)
{
// myNearestKeyIndex = layers[i].position.nearestKeyIndex(0);
var mykeyTime = myLayers[i].position.keyTime(j); // j is a keyframe nr// I want to set the time value of keyfram (j)
nearestTime = Math.round(mykeyTime*fps)/fps; // round to nearest keyframe value;// Copy the position value (x,y,z) of keyframe(j)
var posValueCopy = myLayers[i].position.keyValue(j);// Delete the keyframe
myLayers[i].position.removeKey(j);// Add a replacement key for removed key at correct position
myLayers[i].position.addKey(nearestTime);// Set the position value of keyframe k to the stored position value of deleted keyframe
myLayers[i].position.setValueAtKey(j, posValueCopy);}