summaryrefslogtreecommitdiff
path: root/scene/animation/animation_player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation/animation_player.cpp')
-rw-r--r--scene/animation/animation_player.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 992eb365ed..016db15b73 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -287,7 +287,6 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
// broken track (nonexistent bone)
p_anim->node_cache[i]->skeleton = NULL;
p_anim->node_cache[i]->spatial = NULL;
- printf("bone is %ls\n", String(bone_name).c_str());
ERR_CONTINUE(p_anim->node_cache[i]->bone_idx < 0);
}
} else {
@@ -938,7 +937,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);
@@ -1134,8 +1132,6 @@ void AnimationPlayer::play_backwards(const StringName &p_name, float p_custom_bl
void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float p_custom_scale, bool p_from_end) {
- //printf("animation is %ls\n", String(p_name).c_str());
- //ERR_FAIL_COND(!is_inside_scene());
StringName name = p_name;
if (String(name) == "")
@@ -1196,9 +1192,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;