diff options
Diffstat (limited to 'editor/plugins/animation_tree_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/animation_tree_editor_plugin.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index ed231c446b..1de4fbaabc 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -50,10 +50,18 @@ #include "scene/scene_string_names.h" void AnimationTreeEditor::edit(AnimationTree *p_tree) { + if (p_tree && !p_tree->is_connected("animation_player_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed))) { + p_tree->connect("animation_player_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed), CONNECT_DEFERRED); + } + if (tree == p_tree) { return; } + if (tree && tree->is_connected("animation_player_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed))) { + tree->disconnect("animation_player_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed)); + } + tree = p_tree; Vector<String> path; @@ -73,6 +81,13 @@ void AnimationTreeEditor::_path_button_pressed(int p_path) { } } +void AnimationTreeEditor::_animation_list_changed() { + AnimationNodeBlendTreeEditor *bte = AnimationNodeBlendTreeEditor::get_singleton(); + if (bte) { + bte->update_graph(); + } +} + void AnimationTreeEditor::_update_path() { while (path_hb->get_child_count() > 1) { memdelete(path_hb->get_child(1)); |