From 2d12c1687887f793609133cadf192bf4b29e9502 Mon Sep 17 00:00:00 2001 From: Jonathan Stone Date: Sat, 19 Aug 2023 19:02:52 -0700 Subject: [PATCH] Improve validation in graph editor This changelist improves the document validation step in the graph editor, importing the standard libraries to allow validation of node interfaces as well as document syntax. --- source/MaterialXGraphEditor/Graph.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/MaterialXGraphEditor/Graph.cpp b/source/MaterialXGraphEditor/Graph.cpp index c773ef4457..9bf3afcd1b 100644 --- a/source/MaterialXGraphEditor/Graph.cpp +++ b/source/MaterialXGraphEditor/Graph.cpp @@ -84,7 +84,6 @@ Graph::Graph(const std::string& materialFilename, _geomFilter.push_back(".gltf"); _graphDoc = loadDocument(materialFilename); - _graphDoc->importLibrary(_stdLib); _initial = true; createNodeUIList(_stdLib); @@ -177,6 +176,7 @@ mx::DocumentPtr Graph::loadDocument(mx::FilePath filename) if (!filename.isEmpty()) { mx::readFromXmlFile(doc, filename, _searchPath, &readOptions); + doc->importLibrary(_stdLib); std::string message; if (!doc->validate(&message)) { @@ -4057,7 +4057,6 @@ void Graph::drawGraph(ImVec2 mousePos) std::string graphName = fileName.getBaseName(); _currGraphName.push_back(graphName.substr(0, graphName.length() - 5)); _graphDoc = loadDocument(fileName); - _graphDoc->importLibrary(_stdLib); _initial = true; buildUiBaseGraph(_graphDoc);