diff --git a/src/ShaderNode/ShaderGraph.cpp b/src/ShaderNode/ShaderGraph.cpp index 5bdfe0284..6abfe5379 100644 --- a/src/ShaderNode/ShaderGraph.cpp +++ b/src/ShaderNode/ShaderGraph.cpp @@ -110,17 +110,19 @@ Nz::ShaderAst::StatementPtr ShaderGraph::ToAst() qDebug() << shaderNode->name() << node->id(); auto it = usageCount.find(node->id()); if (it == usageCount.end()) + { + for (const auto& connectionSet : node->nodeState().getEntries(QtNodes::PortType::In)) + { + for (const auto& [uuid, conn] : connectionSet) + { + DetectVariables(conn->getNode(QtNodes::PortType::Out)); + } + } + it = usageCount.insert(node->id(), 0); + } (*it)++; - - for (const auto& connectionSet : node->nodeState().getEntries(QtNodes::PortType::In)) - { - for (const auto& [uuid, conn] : connectionSet) - { - DetectVariables(conn->getNode(QtNodes::PortType::Out)); - } - } }; m_flowScene.iterateOverNodes([&](QtNodes::Node* node)