diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-02-13 20:34:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-13 20:34:35 +0100 |
commit | 325efb60b7b4f7cb4ed11097c8f2e2de973e00d0 (patch) | |
tree | db95e24871dd5e25f43b77e73a51490a2927180f /scene/animation | |
parent | b340b7e804cd6fc6ecc8c14d9645a89a17270281 (diff) | |
parent | 06a0a29711dc1742f11e7713a8a206b698813dfe (diff) |
Merge pull request #25776 from luizcarlos1405/master
Fixes some AnimationPlayer bugs
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/animation_player.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 4c249b117e..54be2aa159 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1205,9 +1205,16 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float _stop_playing_caches(); c.current.from = &animation_set[name]; - c.current.pos = p_from_end ? c.current.from->animation->get_length() : 0; + + if (c.assigned != name) { // reset + c.current.pos = p_from_end ? c.current.from->animation->get_length() : 0; + } else if (p_from_end && c.current.pos == 0) { + // Animation reset BUT played backwards, set position to the end + c.current.pos = c.current.from->animation->get_length(); + } + c.current.speed_scale = p_custom_scale; - c.assigned = p_name; + c.assigned = name; c.seeked = false; c.started = true; @@ -1286,6 +1293,7 @@ void AnimationPlayer::stop(bool p_reset) { if (p_reset) { c.current.from = NULL; c.current.speed_scale = 1; + c.current.pos = 0; } _set_process(false); queued.clear(); |