From a58a08b7a048a581d79ef324bd65c7935935a072 Mon Sep 17 00:00:00 2001 From: Ondrej Stava Date: Fri, 13 Jan 2017 14:28:10 -0800 Subject: [PATCH] Adding support for "vertex_index" property to the ply decoder. The old decoder expected "vertex_indices" for the face list property. --- io/ply_decoder.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/io/ply_decoder.cc b/io/ply_decoder.cc index 960b354..3525d2a 100644 --- a/io/ply_decoder.cc +++ b/io/ply_decoder.cc @@ -86,8 +86,12 @@ bool PlyDecoder::DecodeFaceData(const PlyElement *face_element) { } const int64_t num_faces = face_element->num_entries(); out_mesh_->SetNumFaces(num_faces); - const PlyProperty *const vertex_indices = + const PlyProperty *vertex_indices = face_element->GetPropertyByName("vertex_indices"); + if (vertex_indices == nullptr) { + // The property name may be named either "vertex_indices" or "vertex_index". + vertex_indices = face_element->GetPropertyByName("vertex_index"); + } if (vertex_indices == nullptr || !vertex_indices->is_list()) { return false; // No faces defined. }