You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Fix AnimationPlayer::play() process unwanted start
This commit is contained in:
@@ -415,9 +415,16 @@ void AnimationPlayer::play(const StringName &p_name, double p_custom_blend, floa
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.current.from = &animation_set[name];
|
c.current.from = &animation_set[name];
|
||||||
|
c.current.speed_scale = p_custom_scale;
|
||||||
|
|
||||||
|
if (!end_reached) {
|
||||||
|
playback_queue.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (c.assigned != name) { // Reset.
|
if (c.assigned != name) { // Reset.
|
||||||
c.current.pos = p_from_end ? c.current.from->animation->get_length() : 0;
|
c.current.pos = p_from_end ? c.current.from->animation->get_length() : 0;
|
||||||
|
c.assigned = name;
|
||||||
|
emit_signal(SNAME("current_animation_changed"), c.assigned);
|
||||||
} else {
|
} else {
|
||||||
if (p_from_end && c.current.pos == 0) {
|
if (p_from_end && c.current.pos == 0) {
|
||||||
// Animation reset but played backwards, set position to the end.
|
// Animation reset but played backwards, set position to the end.
|
||||||
@@ -425,18 +432,14 @@ void AnimationPlayer::play(const StringName &p_name, double p_custom_blend, floa
|
|||||||
} else if (!p_from_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 beginning.
|
// Animation resumed but already ended, set position to the beginning.
|
||||||
c.current.pos = 0;
|
c.current.pos = 0;
|
||||||
|
} else if (playing) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c.current.speed_scale = p_custom_scale;
|
|
||||||
c.assigned = name;
|
|
||||||
emit_signal(SNAME("current_animation_changed"), c.assigned);
|
|
||||||
c.seeked = false;
|
c.seeked = false;
|
||||||
c.started = true;
|
c.started = true;
|
||||||
|
|
||||||
if (!end_reached) {
|
|
||||||
playback_queue.clear();
|
|
||||||
}
|
|
||||||
_set_process(true); // Always process when starting an animation.
|
_set_process(true); // Always process when starting an animation.
|
||||||
playing = true;
|
playing = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user