MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/MaterialX / saveDocument

Method saveDocument

source/MaterialXGraphEditor/Graph.cpp:4690–4713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4688}
4689
4690void Graph::saveDocument(mx::FilePath filePath)
4691{
4692 if (filePath.getExtension() != mx::MTLX_EXTENSION)
4693 {
4694 filePath.addExtension(mx::MTLX_EXTENSION);
4695 }
4696
4697 mx::DocumentPtr writeDoc = _graphDoc;
4698
4699 // If requested, create a modified version of the document for saving.
4700 if (!_saveNodePositions)
4701 {
4702 writeDoc = _graphDoc->copy();
4703 for (mx::ElementPtr elem : writeDoc->traverseTree())
4704 {
4705 elem->removeAttribute(mx::Element::XPOS_ATTRIBUTE);
4706 elem->removeAttribute(mx::Element::YPOS_ATTRIBUTE);
4707 }
4708 }
4709
4710 mx::XmlWriteOptions writeOptions;
4711 writeOptions.elementPredicate = getElementPredicate();
4712 mx::writeToXmlFile(writeDoc, filePath, &writeOptions);
4713}

Callers

nothing calls this directly

Calls 4

writeToXmlFileFunction · 0.85
traverseTreeMethod · 0.80
removeAttributeMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected