diff options
author | Juan Linietsky <juan@godotengine.org> | 2019-03-02 11:07:13 -0300 |
---|---|---|
committer | Juan Linietsky <juan@godotengine.org> | 2019-03-02 11:07:13 -0300 |
commit | 90038a4eef6964b4993aa9b70418930f9ea232e4 (patch) | |
tree | c977632b7e8fafc26e55ca4b7f39c30f896b61ec | |
parent | b84b015225dffb373f409c929821da6961e6d485 (diff) |
Fixed a case of broken loop due to wrapping on the edge, closes #25245
-rw-r--r-- | scene/resources/animation.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 2af92a788e..047790cbde 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1836,9 +1836,14 @@ Variant Animation::value_track_interpolate(int p_track, float p_time) const { void Animation::_value_track_get_key_indices_in_range(const ValueTrack *vt, float from_time, float to_time, List<int> *p_indices) const { if (from_time != length && to_time == length) - to_time = length * 1.01; //include a little more if at the end + to_time = length * 1.001; //include a little more if at the end int to = _find(vt->values, to_time); + if (to>=0 && from_time == to_time && vt->values[to].time==from_time) { + //find exact (0 delta), return if found + p_indices->push_back(to); + return; + } // can't really send the events == time, will be sent in the next frame. // if event>=len then it will probably never be requested by the anim player. @@ -1884,7 +1889,7 @@ void Animation::value_track_get_key_indices(int p_track, float p_time, float p_d if (from_time > to_time) { // handle loop by splitting - _value_track_get_key_indices_in_range(vt, length - from_time, length, p_indices); + _value_track_get_key_indices_in_range(vt, from_time, length, p_indices); _value_track_get_key_indices_in_range(vt, 0, to_time, p_indices); return; } |