From 90d7a087bcfc940b26eaddf7e7684fa19cbb5511 Mon Sep 17 00:00:00 2001 From: cignoni Date: Tue, 3 Mar 2009 23:41:00 +0000 Subject: [PATCH] added possibility of skipping header --- wrap/io_trimesh/import_asc.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/wrap/io_trimesh/import_asc.h b/wrap/io_trimesh/import_asc.h index 5027274d..217e8edc 100644 --- a/wrap/io_trimesh/import_asc.h +++ b/wrap/io_trimesh/import_asc.h @@ -86,12 +86,13 @@ static const char *ErrorMsg(int error) * \param lineskip number of lines to be skipped at the begin of the file * \return the operation result */ -static int Open( MESH_TYPE &m, const char * filename, CallBackPos *cb=0,bool triangulate=false) +static int Open( MESH_TYPE &m, const char * filename, CallBackPos *cb=0, bool triangulate=false, int lineskip=0) { FILE *fp; fp = fopen(filename, "r"); if(fp == NULL) { + qDebug("Failed opening of %s",filename); return E_CANTOPEN; } long currentPos = ftell(fp); @@ -106,6 +107,11 @@ static int Open( MESH_TYPE &m, const char * filename, CallBackPos *cb=0,bool tri int cnt=0; int ret; char buf[1024]; + + // skip the first lines + for(int i=0;i::AddVertices(m,1); - (*vi).P().Import(pp); - if(ret==4) (*vi).Q()=q; + if(ret>=3) + { + VertexIterator vi=Allocator::AddVertices(m,1); + (*vi).P().Import(pp); + if(ret==4) (*vi).Q()=q; + } } fclose(fp);