diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2019-04-10 15:48:18 +0200 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2019-04-10 16:25:18 +0200 |
commit | 66e07a2ec628e81bcff052289fa31b6a5333fd70 (patch) | |
tree | e29c18bf68d3167d434b70d3bd1951534dc2c874 /scene/animation | |
parent | 5772f60f960ee8c396574f0c6f94def18bb210c7 (diff) |
Fixes caches_cleared signal discrepancies in AnimationTree (fixes #25460)
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/animation_tree.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 2f209ed946..13b8ebe12d 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -1302,9 +1302,17 @@ void AnimationTree::_notification(int p_what) { _clear_caches(); if (last_animation_player) { - Object *old_player = ObjectDB::get_instance(last_animation_player); - if (old_player) { - old_player->disconnect("caches_cleared", this, "_clear_caches"); + Object *player = ObjectDB::get_instance(last_animation_player); + if (player) { + player->disconnect("caches_cleared", this, "_clear_caches"); + } + } + } else if (p_what == NOTIFICATION_ENTER_TREE) { + if (last_animation_player) { + + Object *player = ObjectDB::get_instance(last_animation_player); + if (player) { + player->connect("caches_cleared", this, "_clear_caches"); } } } |