diff options
author | Luiz <luizcarlos1405@gmail.com> | 2019-02-13 14:40:22 -0300 |
---|---|---|
committer | Luiz <luizcarlos1405@gmail.com> | 2019-02-13 14:40:22 -0300 |
commit | 06a0a29711dc1742f11e7713a8a206b698813dfe (patch) | |
tree | c1100ccad1afd44b3a12d71b801b54c29cb60581 /scene | |
parent | d2765cd04a507a1211a35a9690a482670a49f5fd (diff) |
Fix some AnimationPlayer bugs and update documentation
Diffstat (limited to 'scene')
-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(); |