Since it’s perfectly fine to have two keys with the same timeline
position and MathHelper’s GetFactor method does not check
a and b values not to be equal, special handling of double key
with the same timeline position is added. This resulted in UnityEngine
errors when assigning local position with coordinate values equal NaN.
Reproduction case is having animation with first key at timeline position
zero and last two keys at timeline position of animation end. When trying
to get FrameData for time equal to animation end, factor calculation would
return NaN.
Change in GetMainlineKeys. If having key with id 1 and key with id 2 as duplicates with timeline position 200 and key with id 3 at position 300, GetMainlineKeys now returns key with id 1 and key with id 3, maybe it should return id 2 and id 3 instead? Not clear from Spriter forum message mentioned above.
Example Spriter project to reproduce issue this pull request fixes:
DuplicateKeyRepro.zip
Since it’s perfectly fine to have two keys with the same timeline position and MathHelper’s GetFactor method does not check a and b values not to be equal, special handling of double key with the same timeline position is added. This resulted in UnityEngine errors when assigning local position with coordinate values equal NaN.
Reproduction case is having animation with first key at timeline position zero and last two keys at timeline position of animation end. When trying to get FrameData for time equal to animation end, factor calculation would return NaN.
Maximum duplicate key which can appear in a row is two, for more info see https://brashmonkey.com/forum/index.php?/topic/4083-multiple-keys-with-the-same-timestamp-in-timeline/
One thing I'm not sure about:
Example Spriter project to reproduce issue this pull request fixes: DuplicateKeyRepro.zip
Closes #98