Skip to content

Commit 4ce5f9c

Browse files
committed
Merge pull request #112571 from TokageItLab/change-line-finish-anim
Move the line of calling `animation_finished` signal to ensure stopping
2 parents 18046f5 + e292217 commit 4ce5f9c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

scene/animation/animation_player.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,13 @@ void AnimationPlayer::_blend_capture(double p_delta) {
331331
}
332332

333333
void AnimationPlayer::_blend_post_process() {
334-
if (!finished_anim.is_empty()) {
335-
emit_signal(SceneStringName(animation_finished), finished_anim);
336-
}
337-
338334
if (end_reached) {
339335
// If the method track changes current animation, the animation is not finished.
340336
if (tmp_from == playback.current.from->animation->get_instance_id()) {
341337
if (playback_queue.size()) {
338+
if (!finished_anim.is_empty()) {
339+
emit_signal(SceneStringName(animation_finished), finished_anim);
340+
}
342341
String old = playback.assigned;
343342
play(playback_queue.front()->get());
344343
String new_name = playback.assigned;
@@ -351,6 +350,9 @@ void AnimationPlayer::_blend_post_process() {
351350
playing = false;
352351
_set_process(false);
353352
if (end_notify) {
353+
if (!finished_anim.is_empty()) {
354+
emit_signal(SceneStringName(animation_finished), finished_anim);
355+
}
354356
emit_signal(SNAME("current_animation_changed"), "");
355357
if (movie_quit_on_finish && OS::get_singleton()->has_feature("movie")) {
356358
print_line(vformat("Movie Maker mode is enabled. Quitting on animation finish as requested by: %s", get_path()));

0 commit comments

Comments
 (0)