From e77ebb6cd0879b1460eb7b1f7423c8573d3c1a7c Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 12 Dec 2011 23:25:39 +0000 Subject: [PATCH] corrected small bug in parsing ply files of polylines and added better error reporting --- wrap/io_trimesh/import_ply.h | 5 +++-- wrap/io_trimesh/io_ply.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/wrap/io_trimesh/import_ply.h b/wrap/io_trimesh/import_ply.h index 69da373a..ff7edbc0 100644 --- a/wrap/io_trimesh/import_ply.h +++ b/wrap/io_trimesh/import_ply.h @@ -311,6 +311,7 @@ static const char *ErrorMsg(int error) ply_error_msg[PlyInfo::E_SHORTFILE ]="Unespected eof"; ply_error_msg[PlyInfo::E_NO_3VERTINFACE ]="Face with more than 3 vertices"; ply_error_msg[PlyInfo::E_BAD_VERT_INDEX ]="Bad vertex index in face"; + ply_error_msg[PlyInfo::E_BAD_VERT_INDEX_EDGE ]="Bad vertex index in edge"; ply_error_msg[PlyInfo::E_NO_6TCOORD ]="Face with no 6 texture coordinates"; ply_error_msg[PlyInfo::E_DIFFER_COLORS ]="Number of color differ from vertices"; } @@ -709,9 +710,9 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) pi.status = PlyInfo::E_SHORTFILE; return pi.status; } - if( ea.v1<0 || ea.v2<0 || ea.v1>=m.en || ea.v2>=m.en) + if( ea.v1<0 || ea.v2<0 || ea.v1>=m.vn || ea.v2>=m.vn) { - pi.status = PlyInfo::E_BAD_VERT_INDEX; + pi.status = PlyInfo::E_BAD_VERT_INDEX_EDGE; return pi.status; } (*ei).V(0) = index[ ea.v1 ]; diff --git a/wrap/io_trimesh/io_ply.h b/wrap/io_trimesh/io_ply.h index 626a237f..bc56bec9 100644 --- a/wrap/io_trimesh/io_ply.h +++ b/wrap/io_trimesh/io_ply.h @@ -104,7 +104,8 @@ enum Error E_BAD_VERT_INDEX = ply::E_MAXPLYERRORS+5, // 18 E_NO_6TCOORD = ply::E_MAXPLYERRORS+6, // 19 E_DIFFER_COLORS = ply::E_MAXPLYERRORS+7, - E_MAXPLYINFOERRORS= ply::E_MAXPLYERRORS+8// 20 + E_BAD_VERT_INDEX_EDGE = ply::E_MAXPLYERRORS+8, // 18 + E_MAXPLYINFOERRORS= ply::E_MAXPLYERRORS+9// 20 }; }; // end class