summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-04-11 09:33:33 +0200
committerGitHub <noreply@github.com>2019-04-11 09:33:33 +0200
commit9c514c2606f3acf490ba1c8345fd13c2d2f581a6 (patch)
tree808d3e01fa0f15418ef239545534d728b4d410ba /scene
parentf705fc5a989534e7b3f34a2c8f4a7f0f5912b6ad (diff)
parent66e07a2ec628e81bcff052289fa31b6a5333fd70 (diff)
Merge pull request #27895 from nekomatata/fix-animation-tree-error
Fix caches_cleared signal discrepancies in AnimationTree
Diffstat (limited to 'scene')
-rw-r--r--scene/animation/animation_tree.cpp14
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");
}
}
}