Merge pull request #27895 from nekomatata/fix-animation-tree-error

Fix caches_cleared signal discrepancies in AnimationTree
This commit is contained in:
Rémi Verschelde 2019-04-11 09:33:33 +02:00 committed by GitHub
commit 9c514c2606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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");
}
}
}