Added a test that checks socket propagation into an embedded BlendTree.

This commit is contained in:
Martin Felis
2024-04-01 17:59:25 +02:00
parent 76ea38f118
commit 28eca48a61
3 changed files with 271 additions and 8 deletions
+2 -2
View File
@@ -24,8 +24,8 @@ struct AnimGraphBlendTree : public AnimNode {
char* m_connection_data_storage = nullptr;
char* m_const_node_inputs = nullptr;
std::vector<Socket>& getGraphOutputs() { return m_node_descriptor->m_inputs; }
std::vector<Socket>& getGraphInputs() { return m_node_descriptor->m_outputs; }
std::vector<Socket>& GetGraphOutputs() { return m_node_descriptor->m_inputs; }
std::vector<Socket>& GetGraphInputs() { return m_node_descriptor->m_outputs; }
AnimDataAllocator m_anim_data_allocator;
+19 -4
View File
@@ -397,8 +397,17 @@ bool BlendTreeResource::ConnectSockets(
source_socket_name.c_str());
}
if (source_socket == nullptr || target_socket == nullptr) {
std::cerr << "Cannot connect nodes: could not find sockets." << std::endl;
if (source_socket == nullptr) {
std::cerr << "Cannot connect nodes: could not find source socket '"
<< source_socket_name << "'." << std::endl;
}
if (target_socket == nullptr) {
std::cerr << "Cannot connect nodes: could not find target socket '"
<< target_socket_name << "'." << std::endl;
}
if (target_socket == nullptr || source_socket == nullptr) {
return false;
}
@@ -539,7 +548,7 @@ void AnimGraphResource::PrepareBlendTreeIOData(
// graph inputs
//
int input_block_size = 0;
std::vector<Socket>& graph_inputs = instance.getGraphInputs();
std::vector<Socket>& graph_inputs = instance.GetGraphInputs();
for (int i = 0; i < graph_inputs.size(); i++) {
input_block_size += sizeof(void*);
}
@@ -562,7 +571,7 @@ void AnimGraphResource::PrepareBlendTreeIOData(
// graph outputs
//
int output_block_size = 0;
std::vector<Socket>& graph_outputs = instance.getGraphOutputs();
std::vector<Socket>& graph_outputs = instance.GetGraphOutputs();
for (int i = 0; i < graph_outputs.size(); i++) {
output_block_size += sizeof(void*);
}
@@ -697,6 +706,12 @@ void AnimGraphResource::CreateBlendTreeConnectionInstances(
== target_socket->m_name) {
embedded_target_connection.m_source_node = source_node;
embedded_target_connection.m_crosses_hierarchy = true;
// In addition: make sure we expose the embedded socket to the
// connection in the parent blend tree. That way
// parent_tree.SetValue<>() correctly propagates the value to the
// embedded node socket.
target_socket = &embedded_target_connection.m_target_socket;
}
}
}