diff --git a/source/tinyply.h b/source/tinyply.h index 30eca68..37a3270 100644 --- a/source/tinyply.h +++ b/source/tinyply.h @@ -246,6 +246,18 @@ namespace tinyply return property_type_for_type(); } + template + inline bool is_vector_type(typename std::enable_if::value>::type* = 0) + { + return true; + } + + template + inline bool is_vector_type(typename std::enable_if::value>::type* = 0) + { + return false; + } + class PlyElement { void parse_internal(std::istream & is); @@ -291,7 +303,7 @@ namespace tinyply std::vector objInfo; template - size_t request_properties_from_element(const std::string & elementKey, std::vector propertyKeys, std::vector & source, const int listCount = 1) + size_t request_properties_from_element(const std::string & elementKey, std::vector propertyKeys, std::vector & source, int listCount = 1) { if (get_elements().size() == 0) return 0; @@ -303,6 +315,10 @@ namespace tinyply } else return 0; + // If a vector> is provided, override listCount + if (is_vector_type()) + listCount = 0; + // count and verify large enough auto instance_counter = [&](const std::string & elementKey, const std::string & propertyKey) {