Added saving of edges only if requested in the mask (or if there are no face)

This commit is contained in:
Paolo Cignoni 2012-11-08 18:48:07 +00:00
parent d4cf2019bf
commit 63faedbb88
1 changed files with 21 additions and 18 deletions

View File

@ -362,8 +362,8 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
for(i=0;i<pi.fdn;i++)
fprintf(fpout,"property %s %s\n",pi.FaceData[i].stotypename(),pi.FaceData[i].propname);
// Saving of edges
if(m.en>0)
// Saving of edges is enabled if requested
if( m.en>0 && (pi.mask & Mask::IOM_EDGEINDEX) )
fprintf(fpout,
"element edge %d\n"
"property int vertex1\n"
@ -715,6 +715,8 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
}
assert(fcnt==m.fn);
int eauxvv[2];
if( pi.mask & Mask::IOM_EDGEINDEX )
{
int ecnt=0;
for(EdgeIterator ei=m.edge.begin();ei!=m.edge.end();++ei)
{
@ -732,6 +734,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
}
}
assert(ecnt==m.en);
}
fclose(fpout);
return 0;
}