Skip to content

Commit

Permalink
volumedata is wrtten out as a resource
Browse files Browse the repository at this point in the history
  • Loading branch information
3dJan committed Aug 21, 2024
1 parent 488aeb7 commit 1aa1010
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Source/Model/Writer/v100/NMR_ModelWriterNode100_Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@ namespace NMR {
writeStartElement(XML_3MF_ELEMENT_MESH);

m_pProgressMonitor->SetProgressIdentifier(ProgressIdentifier::PROGRESS_WRITENODES);

// Write id of referenced volume data, if any
if (m_bWriteVolumetricExtension) {
auto pVolumeData = m_pModelMeshObject->getVolumeData();
if (pVolumeData) {
PPackageResourceID pID = pVolumeData->getPackageResourceID();
if (pID->getPath() != m_pModel->currentPath())
throw CNMRException(NMR_ERROR_MODELRESOURCE_IN_DIFFERENT_MODEL);
writePrefixedIntAttribute(XML_3MF_NAMESPACEPREFIX_VOLUMETRIC, XML_3MF_ATTRIBUTE_MESH_VOLUMEDATA, pID->getModelResourceID());
}
}


// Write Vertices
writeStartElement(XML_3MF_ELEMENT_VERTICES);
for (nNodeIndex = 0; nNodeIndex < nNodeCount; nNodeIndex++) {
Expand Down
12 changes: 11 additions & 1 deletion Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,15 @@ namespace NMR {
implicitWriter.writeImplicitFunctions();
}

void CModelWriterNode100_Model::writeMultiProperties()
void CModelWriterNode100_Model::writeVolumeData()
{
CModelWriterNode_VolumeData volumeWriter(m_pModel, m_pXMLWriter,
m_pProgressMonitor);
volumeWriter.writeToXML();
}

void CModelWriterNode100_Model::writeMultiProperties()
{
nfUint32 nCount = m_pModel->getMultiPropertyGroupCount();

for (nfUint32 nIndex = 0; nIndex < nCount; nIndex++)
Expand Down Expand Up @@ -915,6 +922,9 @@ namespace NMR {
if (m_bWriteImplicitExtension) {
writeImplicitFunctions();
}
if (m_bWriteVolumetricExtension) {
writeVolumeData();
}
if (m_bWriteObjects)
writeObjects();
}
Expand Down

0 comments on commit 1aa1010

Please sign in to comment.