From 16a5d7b99918751c350c9f772bdf1a2cf4a3e37c Mon Sep 17 00:00:00 2001 From: Luigi Malomo Date: Wed, 7 Mar 2018 20:12:42 +0100 Subject: [PATCH] corrected importer to handle import of polygonal ply into meshes with polyinfo --- wrap/io_trimesh/import_ply.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/wrap/io_trimesh/import_ply.h b/wrap/io_trimesh/import_ply.h index bd38024f..c391d1d2 100644 --- a/wrap/io_trimesh/import_ply.h +++ b/wrap/io_trimesh/import_ply.h @@ -756,7 +756,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) } } - if(HasPolyInfo(m)) (*fi).Alloc(3); + if(HasPolyInfo(m)) (*fi).Alloc(fa.size); if(HasPerFaceFlags(m) &&( pi.mask & Mask::IOM_FACEFLAGS) ) { @@ -805,6 +805,22 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) (*fi).C()[2] = (unsigned char)((fa.colors[0*3+2]*255+fa.colors[1*3+2]*255+fa.colors[2*3+2]*255)/3.0f); } } + + if (HasPolyInfo(m)) + { + for(k=0; k=m.vn ) + { + pi.status = PlyInfo::E_BAD_VERT_INDEX; + return pi.status; + } + (*fi).V(k) = index[ fa.v[k] ]; + } + fi++; + continue; + } + /// Now the temporary struct 'fa' is ready to be copied into the real face '*fi' /// This loop for(k=0;k<3;++k)