Replace KeyframeReached with event that does not use names as identifiers


#1

AnimationTrack.KeyframeReached returns keyframe names, so it has undefined behavior when there are multiple keyframes with the same name – because of this limitation, it’s hardcoded to not fire for keyframes named “Keyframe”. This makes it impossible to detect when a keyframe is reached unless the animation is carefully crafted with these limitations in mind.

I want to dynamically parse animations not made by me, but this is impossible because keyframes may either have duplicate names or not be named at all. As far as KeyframeReached tells me, there are no keyframes in the animation. KeyframeReached/GetTimeOfKeyframe should be deprecated and replaced with an event that provides the Keyframe instance instead of the name, and always fires. This eliminates the undefined behavior caused by using name as an identifier, while still providing the developer important information such as guaranteed firing, keyframe name (keyframe.Name), and keyframe time (keyframe.Time).

Edit: This is especially difficult to work around as there’s no way to get a table of keyframes for the animation track either. I’ve had to resort to using InsertService to insert the animation and scraping the keyframe data from there.