From b7fb18c1928f6776e05f54214eb537bd3c29a9f7 Mon Sep 17 00:00:00 2001 From: Jan Orend <56254096+3dJan@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:14:31 +0100 Subject: [PATCH] [implicit] Don't write inputs for nodes that are not supposed to have them --- .../Writer/NMR_ModelWriterNode_Implicit.cpp | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Source/Model/Writer/NMR_ModelWriterNode_Implicit.cpp b/Source/Model/Writer/NMR_ModelWriterNode_Implicit.cpp index 2b2eb2e6c..cd29782cf 100644 --- a/Source/Model/Writer/NMR_ModelWriterNode_Implicit.cpp +++ b/Source/Model/Writer/NMR_ModelWriterNode_Implicit.cpp @@ -143,15 +143,23 @@ namespace NMR } - auto inputs = node.getInputs(); - if (!inputs->empty()) + bool const isNodeWithoutInputs = node.getNodeType() == Lib3MF::eImplicitNodeType::Constant || + node.getNodeType() == Lib3MF::eImplicitNodeType::ConstVec || + node.getNodeType() == Lib3MF::eImplicitNodeType::ConstMat || + node.getNodeType() == Lib3MF::eImplicitNodeType::Resource; + + if (!isNodeWithoutInputs) // Certain node types are not allowed to have inputs, but may have been set by the producer { - writeStartElementWithPrefix(XML_3MF_ELEMENT_IMPLICIT_NODE_INPUT, - XML_3MF_NAMESPACEPREFIX_IMPLICIT); + auto inputs = node.getInputs(); + if (!inputs->empty()) { - writeImplicitInputs(*inputs); + writeStartElementWithPrefix(XML_3MF_ELEMENT_IMPLICIT_NODE_INPUT, + XML_3MF_NAMESPACEPREFIX_IMPLICIT); + { + writeImplicitInputs(*inputs); + } + writeFullEndElement(); } - writeFullEndElement(); } writeStartElementWithPrefix(XML_3MF_ELEMENT_IMPLICIT_NODE_OUTPUT,