Minor refactor.

RefactorUnifiedBlendTreeStateMachineHandling
Martin Felis 2024-05-01 13:17:25 +02:00
parent fd032c273b
commit b9789bd1e1
1 changed files with 14 additions and 11 deletions

View File

@ -459,6 +459,7 @@ void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) {
if (input_pin_id && output_pin_id) { if (input_pin_id && output_pin_id) {
int source_node_index; int source_node_index;
int source_node_socket_index; int source_node_socket_index;
const Socket* source_socket = nullptr;
OutputPinIdToNodeIndexAndSocketIndex( OutputPinIdToNodeIndexAndSocketIndex(
input_pin_id.Get(), input_pin_id.Get(),
@ -471,10 +472,17 @@ void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) {
if (source_node->m_socket_accessor->m_outputs.size() if (source_node->m_socket_accessor->m_outputs.size()
< source_node_socket_index) { < source_node_socket_index) {
source_node_socket_index = -1; source_node_socket_index = -1;
} else {
source_socket =
sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex]
->m_blend_tree_resource.GetNodeOutputSocketByIndex(
source_node,
source_node_socket_index);
} }
int target_node_index; int target_node_index;
int target_node_socket_index; int target_node_socket_index;
const Socket* target_socket = nullptr;
InputPinIdToNodeIndexAndSocketIndex( InputPinIdToNodeIndexAndSocketIndex(
output_pin_id.Get(), output_pin_id.Get(),
@ -487,19 +495,14 @@ void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) {
if (target_node->m_socket_accessor->m_inputs.size() if (target_node->m_socket_accessor->m_inputs.size()
< target_node_socket_index) { < target_node_socket_index) {
target_node_socket_index = -1; target_node_socket_index = -1;
} else {
target_socket =
sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex]
->m_blend_tree_resource.GetNodeInputSocketByIndex(
target_node,
target_node_socket_index);
} }
const Socket* source_socket =
sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex]
->m_blend_tree_resource.GetNodeOutputSocketByIndex(
source_node,
source_node_socket_index);
const Socket* target_socket =
sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex]
->m_blend_tree_resource.GetNodeInputSocketByIndex(
target_node,
target_node_socket_index);
if (source_socket == nullptr || target_socket == nullptr if (source_socket == nullptr || target_socket == nullptr
|| !sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex] || !sEditorState.hierarchyStack[sEditorState.hierarchyStackIndex]
->m_blend_tree_resource.IsConnectionValid( ->m_blend_tree_resource.IsConnectionValid(