ShaderNode: Fix useless variables generation

This commit is contained in:
Lynix 2020-05-27 10:00:52 +02:00
parent d96bc9db6e
commit 1d033aabfd
1 changed files with 10 additions and 8 deletions

View File

@ -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)