Further cleanup and added comments.
This commit is contained in:
		
							parent
							
								
									283306f225
								
							
						
					
					
						commit
						f52b19a8d2
					
				| @ -37,8 +37,10 @@ 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_outputs; | ||||
|   } | ||||
|   std::vector<Socket>& GetGraphInputs() { return m_node_descriptor->m_inputs; } | ||||
| 
 | ||||
|   AnimDataAllocator m_anim_data_allocator; | ||||
| 
 | ||||
| @ -100,7 +102,7 @@ struct AnimGraphBlendTree : public AnimNode { | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /** Sets the address that is used for the specified AnimGraph input Socket.
 | ||||
|   /** Sets the address that is used for the specified BlendTree input Socket.
 | ||||
|    * | ||||
|    * @tparam T Type of the Socket. | ||||
|    * @param name Name of the Socket. | ||||
| @ -122,7 +124,7 @@ struct AnimGraphBlendTree : public AnimNode { | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /** Sets the address that is used for the specified AnimGraph output Socket.
 | ||||
|   /** Sets the address that is used for the specified BlendTree output Socket.
 | ||||
|    * | ||||
|    * We update the pointer of the outputting node. We also have to ensure that | ||||
|    * all usages of that output use the same pointer. | ||||
| @ -155,6 +157,7 @@ struct AnimGraphBlendTree : public AnimNode { | ||||
|       return; | ||||
|     } | ||||
| 
 | ||||
|     // Ensure that all connections that consume the output use the updated address.
 | ||||
|     size_t output_node_index = | ||||
|         GetAnimNodeIndex(graph_output_connection->m_source_node); | ||||
| 
 | ||||
| @ -168,6 +171,12 @@ struct AnimGraphBlendTree : public AnimNode { | ||||
|     } | ||||
| 
 | ||||
|     *graph_output_connection->m_socket.m_reference.ptr_ptr = value_ptr; | ||||
| 
 | ||||
|     // And additionally update the BlendTree's node descriptor:
 | ||||
|     Socket* blend_tree_output_socket = m_node_descriptor->GetOutputSocket(name); | ||||
|     assert(blend_tree_output_socket != nullptr); | ||||
| 
 | ||||
|     *blend_tree_output_socket->m_reference.ptr_ptr = value_ptr; | ||||
|   } | ||||
| 
 | ||||
|   /** Returns the address that is used for the specified AnimGraph output Socket.
 | ||||
|  | ||||
| @ -977,7 +977,7 @@ void BlendTreeResource::PrepareBlendTreeIOData( | ||||
|   for (int i = 0; i < graph_inputs.size(); i++) { | ||||
|     graph_inputs[i].m_reference.ptr = | ||||
|         (void*)&instance.m_input_buffer[input_block_offset]; | ||||
|     instance.m_node_descriptor->m_outputs[i].m_reference.ptr = | ||||
|     instance.m_node_descriptor->m_inputs[i].m_reference.ptr = | ||||
|         &instance.m_input_buffer[input_block_offset]; | ||||
|     input_block_offset += sizeof(void*); | ||||
|   } | ||||
| @ -998,7 +998,7 @@ void BlendTreeResource::PrepareBlendTreeIOData( | ||||
| 
 | ||||
|   int output_block_offset = 0; | ||||
|   for (int i = 0; i < graph_outputs.size(); i++) { | ||||
|     instance.m_node_descriptor->m_inputs[i].m_reference.ptr = | ||||
|     instance.m_node_descriptor->m_outputs[i].m_reference.ptr = | ||||
|         &instance.m_output_buffer[output_block_offset]; | ||||
|     output_block_offset += sizeof(void*); | ||||
|   } | ||||
|  | ||||
| @ -209,11 +209,20 @@ TEST_CASE_METHOD( | ||||
|   // Get runtime graph inputs and outputs
 | ||||
|   float graph_float_input = 0.f; | ||||
|   blend_tree.SetInput("GraphFloatInput", &graph_float_input); | ||||
|   CHECK(blend_tree.GetGraphInputs().size() == 1); | ||||
|   CHECK( | ||||
|       *blend_tree.GetGraphInputs()[0].m_reference.ptr_ptr | ||||
|       == &graph_float_input); | ||||
| 
 | ||||
|   AnimData graph_anim_output; | ||||
|   graph_anim_output.m_local_matrices.resize(skeleton->num_joints()); | ||||
|   blend_tree.SetOutput("Output", &graph_anim_output); | ||||
| 
 | ||||
|   CHECK(blend_tree.GetGraphOutputs().size() == 1); | ||||
|   CHECK( | ||||
|       *blend_tree.GetGraphOutputs()[0].m_reference.ptr_ptr | ||||
|       == &graph_anim_output); | ||||
| 
 | ||||
|   WHEN("Blend Weight == 0.") { | ||||
|     // Evaluate graph
 | ||||
|     graph_float_input = 0.f; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Martin Felis
						Martin Felis