summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-10-18 16:55:02 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-10-18 16:55:02 +0200
commitf7da96add36162ca10fc38330c9938eafac3897c (patch)
tree226028810836317ca9bbcf968923569049d21a0f
parent49f492d54bf955e2d1621ede03debcf830618c68 (diff)
parent65016c393f17754fe3bd62a51dac9379f471c2d0 (diff)
downloadredot-engine-f7da96add36162ca10fc38330c9938eafac3897c.tar.gz
Merge pull request #83534 from SaracenOne/blend_tree_auto_disconnect
Automatic reconnection of nodes in blend tree.
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 673f135a54..772957bc55 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;