summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorLuiz <luizcarlos1405@gmail.com>2019-02-20 14:58:53 -0400
committerLuiz <luizcarlos1405@gmail.com>2019-02-20 14:58:53 -0400
commite27bbb075a256a648283f4e8fa4b49e600208555 (patch)
tree7732edab392cf164fcb9fff21b74486cae4c7128 /scene
parentaa5b99821b23d74eafb49f4b0d2d86fe693a903c (diff)
Fix AnimationPlayer jumping to the beggining after ending on editor.
Diffstat (limited to 'scene')
-rw-r--r--scene/animation/animation_player.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 992eb365ed..43ec8cebb0 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -938,7 +938,6 @@ void AnimationPlayer::_animation_process(float p_delta) {
} else {
//stop();
playing = false;
- playback.current.pos = 0;
_set_process(false);
if (end_notify)
emit_signal(SceneStringNames::get_singleton()->animation_finished, playback.assigned);
@@ -1196,9 +1195,14 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
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();
+ } 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();
+ } else if (!p_from_end && c.current.pos == c.current.from->animation->get_length()) {
+ // Animation resumed but already ended, set position to the beggining
+ c.current.pos = 0;
+ }
}
c.current.speed_scale = p_custom_scale;