From 65016c393f17754fe3bd62a51dac9379f471c2d0 Mon Sep 17 00:00:00 2001 From: Saracen Date: Wed, 18 Oct 2023 03:19:02 +0100 Subject: [PATCH] Automatic reconnection of nodes in blend tree. --- editor/plugins/animation_blend_tree_editor_plugin.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 673f135a5435..772957bc5530 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -447,6 +447,11 @@ void AnimationNodeBlendTreeEditor::_connection_request(const String &p_from, int AnimationNodeBlendTree::ConnectionError err = blend_tree->can_connect_node(p_to, p_to_index, p_from); + if (err == AnimationNodeBlendTree::CONNECTION_ERROR_CONNECTION_EXISTS) { + blend_tree->disconnect_node(p_to, p_to_index); + err = blend_tree->can_connect_node(p_to, p_to_index, p_from); + } + if (err != AnimationNodeBlendTree::CONNECTION_OK) { EditorNode::get_singleton()->show_warning(TTR("Unable to connect, port may be in use or connection may be invalid.")); return;