Fix key search for animation curves

The binary search used to determine the key id in an animation curve
(USBinarySearchNearest) never returned the last key for curves with
an even number of keys.

Fixed by replacing the break conditions with a stricter loop condition
and returning either the lower or the upper bound (i or j).
Merge pull request #673 from theGoodEvil/fix_anim_curve_key_search

Fix Key Frame Search for Animation Curves