Removed node input splitting.
parent
306a2cb4d8
commit
d6453911e2
|
@ -359,7 +359,7 @@ void AnimGraph::UpdateOrderedNodes() {
|
||||||
|
|
||||||
while (node_index_stack.size() > 0) {
|
while (node_index_stack.size() > 0) {
|
||||||
std::vector<NodeInput>& node_inputs =
|
std::vector<NodeInput>& node_inputs =
|
||||||
m_node_anim_inputs[node_index_stack.back()];
|
m_node_inputs[node_index_stack.back()];
|
||||||
node_index_stack.pop_back();
|
node_index_stack.pop_back();
|
||||||
|
|
||||||
for (size_t i = 0, n = node_inputs.size(); i < n; i++) {
|
for (size_t i = 0, n = node_inputs.size(); i < n; i++) {
|
||||||
|
@ -405,7 +405,7 @@ void AnimGraph::MarkActiveNodes() {
|
||||||
AnimNode* node = m_eval_ordered_nodes[i];
|
AnimNode* node = m_eval_ordered_nodes[i];
|
||||||
if (CheckIsNodeActive(node)) {
|
if (CheckIsNodeActive(node)) {
|
||||||
int node_index = getAnimNodeIndex(node);
|
int node_index = getAnimNodeIndex(node);
|
||||||
node->MarkActiveInputs(m_node_anim_inputs[node_index]);
|
node->MarkActiveInputs(m_node_inputs[node_index]);
|
||||||
|
|
||||||
// Non-animation data inputs are always active.
|
// Non-animation data inputs are always active.
|
||||||
for (size_t j = 0, nj = m_node_inputs[node_index].size(); j < nj; j++) {
|
for (size_t j = 0, nj = m_node_inputs[node_index].size(); j < nj; j++) {
|
||||||
|
@ -419,7 +419,7 @@ void AnimGraph::MarkActiveNodes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimGraph::UpdateTime(float dt) {
|
void AnimGraph::UpdateTime(float dt) {
|
||||||
const std::vector<NodeInput> graph_output_inputs = m_node_anim_inputs[0];
|
const std::vector<NodeInput> graph_output_inputs = m_node_inputs[0];
|
||||||
for (size_t i = 0, n = graph_output_inputs.size(); i < n; i++) {
|
for (size_t i = 0, n = graph_output_inputs.size(); i < n; i++) {
|
||||||
AnimNode* node = m_eval_ordered_nodes[i];
|
AnimNode* node = m_eval_ordered_nodes[i];
|
||||||
if (node != nullptr) {
|
if (node != nullptr) {
|
||||||
|
@ -434,14 +434,17 @@ void AnimGraph::UpdateTime(float dt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int node_index = getAnimNodeIndex(node);
|
int node_index = getAnimNodeIndex(node);
|
||||||
const std::vector<NodeInput> node_anim_inputs =
|
const std::vector<NodeInput> node_inputs =
|
||||||
m_node_anim_inputs[node_index];
|
m_node_inputs[node_index];
|
||||||
float node_time_now = node->m_time_now;
|
float node_time_now = node->m_time_now;
|
||||||
float node_time_last = node->m_time_last;
|
float node_time_last = node->m_time_last;
|
||||||
|
|
||||||
for (size_t i = 0, n = node_anim_inputs.size(); i < n; i++) {
|
for (size_t i = 0, n = node_inputs.size(); i < n; i++) {
|
||||||
AnimNode* input_node = node_anim_inputs[i].m_node;
|
AnimNode* input_node = node_inputs[i].m_node;
|
||||||
|
|
||||||
|
// Only propagate time updates via animation sockets.
|
||||||
if (input_node != nullptr
|
if (input_node != nullptr
|
||||||
|
&& node_inputs[i].m_type == SocketType::SocketTypeAnimation
|
||||||
&& input_node->m_state == AnimNodeEvalState::Activated) {
|
&& input_node->m_state == AnimNodeEvalState::Activated) {
|
||||||
input_node->UpdateTime(node_time_last, node_time_now);
|
input_node->UpdateTime(node_time_last, node_time_now);
|
||||||
}
|
}
|
||||||
|
|
|
@ -613,7 +613,6 @@ struct AnimGraph {
|
||||||
std::vector<AnimNode*> m_nodes;
|
std::vector<AnimNode*> m_nodes;
|
||||||
std::vector<AnimNode*> m_eval_ordered_nodes;
|
std::vector<AnimNode*> m_eval_ordered_nodes;
|
||||||
std::vector<std::vector<NodeInput> > m_node_inputs;
|
std::vector<std::vector<NodeInput> > m_node_inputs;
|
||||||
std::vector<std::vector<NodeInput> > m_node_anim_inputs;
|
|
||||||
NodeSocketAccessorBase* m_socket_accessor;
|
NodeSocketAccessorBase* m_socket_accessor;
|
||||||
char* m_input_buffer = nullptr;
|
char* m_input_buffer = nullptr;
|
||||||
char* m_output_buffer = nullptr;
|
char* m_output_buffer = nullptr;
|
||||||
|
@ -637,9 +636,9 @@ struct AnimGraph {
|
||||||
size_t node_index,
|
size_t node_index,
|
||||||
const std::string& input_name) {
|
const std::string& input_name) {
|
||||||
assert(node_index < m_nodes.size());
|
assert(node_index < m_nodes.size());
|
||||||
assert(node_index < m_node_anim_inputs.size());
|
assert(node_index < m_node_inputs.size());
|
||||||
|
|
||||||
std::vector<NodeInput>& node_inputs = m_node_anim_inputs[node_index];
|
std::vector<NodeInput>& node_inputs = m_node_inputs[node_index];
|
||||||
for (size_t i = 0, n = node_inputs.size(); i < n; i++) {
|
for (size_t i = 0, n = node_inputs.size(); i < n; i++) {
|
||||||
if (node_inputs[i].m_input_name == input_name) {
|
if (node_inputs[i].m_input_name == input_name) {
|
||||||
return node_inputs[i].m_node;
|
return node_inputs[i].m_node;
|
||||||
|
@ -684,8 +683,6 @@ struct AnimGraph {
|
||||||
assert(node_resource.m_socket_accessor != nullptr);
|
assert(node_resource.m_socket_accessor != nullptr);
|
||||||
result.m_node_inputs.push_back(std::vector<NodeInput>());
|
result.m_node_inputs.push_back(std::vector<NodeInput>());
|
||||||
std::vector<NodeInput>& node_inputs = result.m_node_inputs.back();
|
std::vector<NodeInput>& node_inputs = result.m_node_inputs.back();
|
||||||
result.m_node_anim_inputs.push_back(std::vector<NodeInput>());
|
|
||||||
std::vector<NodeInput>& node_anim_inputs = result.m_node_anim_inputs.back();
|
|
||||||
|
|
||||||
for (int j = 0, n = node_resource.m_socket_accessor->m_inputs.size();
|
for (int j = 0, n = node_resource.m_socket_accessor->m_inputs.size();
|
||||||
j < n;
|
j < n;
|
||||||
|
@ -699,10 +696,6 @@ struct AnimGraph {
|
||||||
input.m_input_name = input_socket.m_name;
|
input.m_input_name = input_socket.m_name;
|
||||||
|
|
||||||
node_inputs.push_back(input);
|
node_inputs.push_back(input);
|
||||||
|
|
||||||
if (input_socket.m_type == SocketType::SocketTypeAnimation) {
|
|
||||||
node_anim_inputs.push_back(input);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -838,14 +831,6 @@ struct AnimGraph {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<NodeInput>& node_anim_inputs =
|
|
||||||
result.m_node_anim_inputs[target_node_index];
|
|
||||||
for (int j = 0, n = node_anim_inputs.size(); j < n; j++) {
|
|
||||||
if (node_anim_inputs[j].m_input_name == target_socket->m_name) {
|
|
||||||
node_anim_inputs[j].m_node = source_node;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target_node_accessor != result.m_socket_accessor) {
|
if (target_node_accessor != result.m_socket_accessor) {
|
||||||
delete target_node_accessor;
|
delete target_node_accessor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,11 +94,12 @@ TEST_CASE("BasicGraph", "[AnimGraphResource]") {
|
||||||
size_t anim_sampler_index1 = graph.getAnimNodeIndex(anim_sampler_instance1);
|
size_t anim_sampler_index1 = graph.getAnimNodeIndex(anim_sampler_instance1);
|
||||||
size_t blend_index = graph.getAnimNodeIndex(blend2_instance);
|
size_t blend_index = graph.getAnimNodeIndex(blend2_instance);
|
||||||
|
|
||||||
CHECK(graph.m_node_anim_inputs[anim_sampler_index0].size() == 0);
|
CHECK(graph.m_node_inputs[anim_sampler_index0].size() == 0);
|
||||||
CHECK(graph.m_node_anim_inputs[anim_sampler_index1].size() == 0);
|
CHECK(graph.m_node_inputs[anim_sampler_index1].size() == 0);
|
||||||
CHECK(graph.m_node_anim_inputs[blend_index].size() == 2);
|
CHECK(graph.m_node_inputs[blend_index].size() == 3);
|
||||||
CHECK(graph.m_node_anim_inputs[blend_index][0].m_node == anim_sampler_instance0);
|
CHECK(graph.m_node_inputs[blend_index][0].m_node == anim_sampler_instance0);
|
||||||
CHECK(graph.m_node_anim_inputs[blend_index][1].m_node == anim_sampler_instance1);
|
CHECK(graph.m_node_inputs[blend_index][1].m_node == anim_sampler_instance1);
|
||||||
|
CHECK(graph.m_node_inputs[blend_index][2].m_node == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("InputAttributeConversion", "[AnimGraphResource]") {
|
TEST_CASE("InputAttributeConversion", "[AnimGraphResource]") {
|
||||||
|
|
Loading…
Reference in New Issue