Skip to content

Commit

Permalink
Disallow trying to traverse through nodes in definition as there is a…
Browse files Browse the repository at this point in the history
…n issue with trying to render the root of std surface,

and there is not mechanism to traverse out of a functional graph to it's instance and downstream.
  • Loading branch information
kwokcb committed Jul 14, 2023
1 parent 3bdb7df commit f5d8984
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions source/MaterialXGraphEditor/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,18 @@ void Graph::setRenderMaterial(UiNodePtr node)
mx::StringSet testPaths;
if (mtlxNode)
{
mx::ElementPtr parent = mtlxNode->getParent();
if (parent->isA<mx::NodeGraph>())
{
// There is no logic to support traversing from inside a functional graph
// to it's instance and hence downstream so skip this from consideration.
// The closest approach would be to "flatten" all definitions to compound graphs.
mx::NodeGraphPtr parentGraph = parent->asA<mx::NodeGraph>();
if (parentGraph->getNodeDef())
{
return;
}
}
testPaths.insert(mtlxNode->getNamePath());
}
else if (mtlxNodeGraph)
Expand Down Expand Up @@ -3755,11 +3767,7 @@ void Graph::drawGraph(ImVec2 mousePos)
{
setRenderMaterial(_currUiNode);
}
else if (_currUiNode->getNodeGraph())
{
setRenderMaterial(_currUiNode);
}
else if (_currUiNode->getOutput())
else if (_currUiNode->getNodeGraph() || _currUiNode->getOutput())
{
setRenderMaterial(_currUiNode);
}
Expand Down

0 comments on commit f5d8984

Please sign in to comment.