Here's what I've found so far.
Adding keys with setValueAtKey or setValueAtTime takes massively longer than putting all the times and values in two arrays and running setValuesAtTimes.
However, setValuesAtTimes (and the rest of the setValue methods) don't return the key indexes of the newly created keys.
So, if I want to edit the new keys later, I need to do one of the following:
a) run nearestKeyIndex for each of my times to get the index of each new keyframe
Code: Select all
setValuesAtTimes(times, values);
for (i=0;i<times.length-1;i++) {
indexes.push(nearestKeyIndex(times[i]);
}
Code: Select all
for (i=0;i<times.length-1;i++) {
indexes.push(addKey(time));
}
setValuesAtTimes(times, values);
So, any suggestions on how to speed up getting all the indexes of newly created keys?
Or is there maybe some undocumented way to get the list of indexes back from setValuesAtTimes()?