From 87eb2ab7df5791d64fd47bf2250525f90ffe269b Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Sun, 20 Feb 2022 16:00:45 +0100 Subject: [PATCH] Mark all nodes that connect to the graph output nodes by default as active. --- src/AnimGraphResource.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/AnimGraphResource.cc b/src/AnimGraphResource.cc index 61f6112..fecf245 100644 --- a/src/AnimGraphResource.cc +++ b/src/AnimGraphResource.cc @@ -389,11 +389,15 @@ void AnimGraph::UpdateOrderedNodes() { void AnimGraph::MarkActiveNodes() { m_frame_counter++; - int first_node_index = getAnimNodeIndex(m_ordered_nodes[0]); - m_ordered_nodes[0]->m_frame_counter = m_frame_counter; - m_ordered_nodes[0]->UpdateActiveInputFrameCounters(m_node_inputs[first_node_index]); + const std::vector graph_output_inputs = m_node_inputs[0]; + for (size_t i = 0, n = graph_output_inputs.size(); i < n; i++) { + AnimNode* node = m_ordered_nodes[i]; + if (node != nullptr) { + node->m_frame_counter = m_frame_counter; + } + } - for (size_t i = 1, n = m_ordered_nodes.size(); i < n; i++) { + for (size_t i = 0, n = m_ordered_nodes.size(); i < n; i++) { AnimNode* node = m_ordered_nodes[i]; if (CheckIsNodeActive(node)) { int node_index = getAnimNodeIndex(node);