Skip to content

Commit

Permalink
Fixing namespace check for volumetric and implicit
Browse files Browse the repository at this point in the history
  • Loading branch information
3dJan committed Feb 19, 2024
1 parent b7fb18c commit f0ac0b9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
29 changes: 28 additions & 1 deletion Source/Model/Classes/NMR_Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,34 @@ namespace NMR {
return false;
}

return false;
if(sExtension == XML_3MF_NAMESPACE_VOLUMETRICSPEC)
{
for(size_t i = 0; i < m_ObjectLookup.size(); i++)
{
CModelMeshObject *pMeshObject =
dynamic_cast<CModelMeshObject *>(
m_ObjectLookup[i].get());
if(pMeshObject == nullptr ||
pMeshObject->getMesh() == nullptr)
continue;

auto volumeData = pMeshObject->getVolumeData();
if (!volumeData)
continue;

if (volumeData->hasBoundary() || volumeData->hasColor() || volumeData->getPropertyCount() > 0 || volumeData->hasComposite())
{
return true;
}
}
}

if (sExtension == XML_3MF_NAMESPACE_IMPLICITSPEC)
{
if (m_FunctionLookup.size() > 0)
return true;
}
return false;
}

nfUint32 CModel::getSliceStackCount() {
Expand Down
10 changes: 10 additions & 0 deletions Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,20 @@ namespace NMR {

if (m_bWriteVolumetricExtension) {
writeConstPrefixedStringAttribute(XML_3MF_ATTRIBUTE_XMLNS, XML_3MF_NAMESPACEPREFIX_VOLUMETRIC, XML_3MF_NAMESPACE_VOLUMETRICSPEC);
if (m_pModel->RequireExtension(XML_3MF_NAMESPACE_VOLUMETRICSPEC)) {
if (sRequiredExtensions.size() > 0)
sRequiredExtensions = sRequiredExtensions + " ";
sRequiredExtensions = sRequiredExtensions + XML_3MF_NAMESPACEPREFIX_VOLUMETRIC;
}
}

if (m_bWriteImplicitExtension) {
writeConstPrefixedStringAttribute(XML_3MF_ATTRIBUTE_XMLNS, XML_3MF_NAMESPACEPREFIX_IMPLICIT, XML_3MF_NAMESPACE_IMPLICITSPEC);
if (m_pModel->RequireExtension(XML_3MF_NAMESPACE_IMPLICITSPEC)) {
if (sRequiredExtensions.size() > 0)
sRequiredExtensions = sRequiredExtensions + " ";
sRequiredExtensions = sRequiredExtensions + XML_3MF_NAMESPACEPREFIX_IMPLICIT;
}
}

if (m_bWriteCustomNamespaces) {
Expand Down

0 comments on commit f0ac0b9

Please sign in to comment.