From b9959ee7a62b791e13c49167dc57f68c9c10b9cf Mon Sep 17 00:00:00 2001 From: cignoni Date: Thu, 25 Jun 2009 14:06:50 +0000 Subject: [PATCH] Corrected bug that prevented the loading of x y z raw ascii files (only x, y, z, files were supported) --- wrap/io_trimesh/import_asc.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wrap/io_trimesh/import_asc.h b/wrap/io_trimesh/import_asc.h index 217e8edc..909bf589 100644 --- a/wrap/io_trimesh/import_asc.h +++ b/wrap/io_trimesh/import_asc.h @@ -63,6 +63,7 @@ enum RAWError { // Error open E_CANTOPEN, // 1 E_UNESPECTEDEOF, // 2 + E_NO_POINTS, //3 }; static const char *ErrorMsg(int error) @@ -72,9 +73,10 @@ static const char *ErrorMsg(int error) "No errors", "Can't open file", "Premature End of file", + "Failed to import any point. Use simple ascii files with just x y z coords." }; - if(error>2 || error<0) return "Unknown error"; + if(error>3 || error<0) return "Unknown error"; else return raw_error_msg[error]; }; @@ -112,13 +114,16 @@ static int Open( MESH_TYPE &m, const char * filename, CallBackPos *cb=0, bool tr for(int i=0;i=3) { VertexIterator vi=Allocator::AddVertices(m,1); @@ -128,6 +133,7 @@ static int Open( MESH_TYPE &m, const char * filename, CallBackPos *cb=0, bool tr } fclose(fp); + if(m.vn==0) return E_NO_POINTS; if(!triangulate) return E_NOERROR; // now try to triangulate. // search for the first jump