From 1a452686398887842cbc98d7a56fc0337256f279 Mon Sep 17 00:00:00 2001 From: Silc Renew Date: Fri, 2 Dec 2022 14:05:04 +0900 Subject: [PATCH] Fix animation signal caches_cleared firing timing (cherry picked from commit 962b6a3e8f9d91f92f2547e2da6ba8dbd5a661dc) --- scene/animation/animation_player.cpp | 3 ++- scene/animation/animation_tree.cpp | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 44d568407d8..4bfed54122b 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1337,7 +1337,6 @@ float AnimationPlayer::get_current_animation_length() const { void AnimationPlayer::_animation_changed() { clear_caches(); - emit_signal("caches_cleared"); if (is_playing()) { playback.seeked = true; //need to restart stuff, like audio } @@ -1376,6 +1375,8 @@ void AnimationPlayer::clear_caches() { cache_update_size = 0; cache_update_prop_size = 0; cache_update_bezier_size = 0; + + emit_signal("caches_cleared"); } void AnimationPlayer::set_active(bool p_active) { diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index f371824c029..b333b780d7c 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -713,7 +713,6 @@ void AnimationTree::_clear_caches() { memdelete(track_cache[*K]); } playing_caches.clear(); - track_cache.clear(); cache_valid = false; }