From: msv Date: Fri, 23 Jul 2021 18:18:22 +0000 (+0300) Subject: 0032491: Application Framework - BinTools_ShapeWriter attempts to get normals from... X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=e1479eb0aa3875103f3f5d07e732ce1e86f879af;p=occt-copy.git 0032491: Application Framework - BinTools_ShapeWriter attempts to get normals from triangulation without checking HasNormals() Check if triangulation has normals before requesting them. --- diff --git a/src/BinTools/BinTools_ShapeWriter.cxx b/src/BinTools/BinTools_ShapeWriter.cxx index ac604c7bd4..a6c1a97204 100644 --- a/src/BinTools/BinTools_ShapeWriter.cxx +++ b/src/BinTools/BinTools_ShapeWriter.cxx @@ -470,7 +470,8 @@ void BinTools_ShapeWriter::WriteTriangulation (BinTools_OStream& theStream, const Standard_Integer aNbNodes = theTriangulation->NbNodes(); const Standard_Integer aNbTriangles = theTriangulation->NbTriangles(); theStream << aNbNodes << aNbTriangles << theTriangulation->HasUVNodes(); - theStream << theNeedToWriteNormals << theTriangulation->Deflection(); + theStream << (theTriangulation->HasNormals() && theNeedToWriteNormals); + theStream << theTriangulation->Deflection(); // write the 3d nodes for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter) theStream << theTriangulation->Node (aNodeIter); @@ -484,7 +485,7 @@ void BinTools_ShapeWriter::WriteTriangulation (BinTools_OStream& theStream, for (Standard_Integer aTriIter = 1; aTriIter <= aNbTriangles; ++aTriIter) theStream << theTriangulation->Triangle (aTriIter); - if (theNeedToWriteNormals) + if (theTriangulation->HasNormals() && theNeedToWriteNormals) { gp_Vec3f aNormal; for (Standard_Integer aNormalIter = 1; aNormalIter <= aNbNodes; ++aNormalIter)