From acbe3a4ed58c85ece14e47098fa5304a09952801 Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Sun, 2 Mar 2025 12:56:47 +0100 Subject: [PATCH] Fixed adding links to output node of blend tree. --- src/AnimGraphEditor/AnimGraphEditor.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/AnimGraphEditor/AnimGraphEditor.cc b/src/AnimGraphEditor/AnimGraphEditor.cc index d600d1f..4b21296 100644 --- a/src/AnimGraphEditor/AnimGraphEditor.cc +++ b/src/AnimGraphEditor/AnimGraphEditor.cc @@ -533,6 +533,12 @@ void HandleConnectionCreation(BlendTreeResource& current_blend_tree) { if (ax::NodeEditor::BeginCreate()) { ax::NodeEditor::PinId input_pin_id, output_pin_id; if (ax::NodeEditor::QueryNewLink(&input_pin_id, &output_pin_id)) { + if (input_pin_id == output_pin_id) { + ax::NodeEditor::RejectNewItem(); + ax::NodeEditor::EndCreate(); + return; + } + ax::NodeEditor::PinId source_pin = input_pin_id; ax::NodeEditor::PinId target_pin = output_pin_id; @@ -561,7 +567,7 @@ void HandleConnectionCreation(BlendTreeResource& current_blend_tree) { } } - if (source_pin) { + if (!source_pin.Invalid) { OutputPinIdToNodeIndexAndSocketIndex( source_pin.Get(), &source_node_index, @@ -586,7 +592,7 @@ void HandleConnectionCreation(BlendTreeResource& current_blend_tree) { const AnimNodeResource* target_node = nullptr; const Socket* target_socket = nullptr; - if (target_pin) { + if (!target_pin.Invalid) { InputPinIdToNodeIndexAndSocketIndex( target_pin.Get(), &target_node_index, @@ -620,7 +626,7 @@ void HandleConnectionCreation(BlendTreeResource& current_blend_tree) { target_node_socket_index; sNodeConnectionDebugState.targetSocket.socket = target_socket; - if (source_pin && target_pin) { + if (!source_pin.Invalid && !target_pin.Invalid) { if (source_socket == nullptr || target_socket == nullptr || !current_blend_tree.IsConnectionValid( source_node,