diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-01-29 13:46:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-29 13:46:38 +0100 |
commit | 2f57a11ed9b383706b72783c0d9b1e869774e08a (patch) | |
tree | 1b2b19bbc51b9b6ee71b3d7599092bdaa7b6dbee /scene/resources/animation.cpp | |
parent | 9467350f37089eb3f4ef7de683daba28b0c69dec (diff) | |
parent | 8a0a3acceee804b91afe31022cf0310c01162f73 (diff) |
Merge pull request #55785 from nathanfranke/clang-tidy
Diffstat (limited to 'scene/resources/animation.cpp')
-rw-r--r-- | scene/resources/animation.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index a1e66fabb1..b6151bccf4 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -2474,34 +2474,38 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, double p_time, Interpol real_t delta = (length - p_keys[next].time) - (length - p_keys[idx].time); real_t from = (length - p_time) - (length - p_keys[idx].time); - if (Math::is_zero_approx(delta)) + if (Math::is_zero_approx(delta)) { c = 0; - else + } else { c = from / delta; + } } else { next = len - 1; real_t delta = p_keys[idx].time + (length - p_keys[next].time); real_t from = (length - p_time) - (length - p_keys[idx].time); - if (Math::is_zero_approx(delta)) + if (Math::is_zero_approx(delta)) { c = 0; - else + } else { c = from / delta; + } } } else { // on loop, in front of last key idx = 0; next = len - 1; real_t endtime = p_keys[idx].time; - if (endtime > length) // may be keys past the end + if (endtime > length) { // may be keys past the end endtime = length; + } real_t delta = p_keys[next].time - endtime; real_t from = p_time - endtime; - if (Math::is_zero_approx(delta)) + if (Math::is_zero_approx(delta)) { c = 0; - else + } else { c = from / delta; + } } } } else { // no loop |