You need to sign in or sign up before continuing.
Commit f2d1d2db authored by Jeremy Reizenstein's avatar Jeremy Reizenstein Committed by Facebook GitHub Bot
Browse files

Alternative type names in PLY #205

Summary: Add ability to decode ply files which use types like int32.

Reviewed By: nikhilaravi

Differential Revision: D21639208

fbshipit-source-id: 0ede7d4aa353a6e940446680a18e7ac0c48fafee
parent b4fd9d1d
......@@ -26,6 +26,14 @@ _PLY_TYPES = {
"uint": _PlyTypeData(4, "I", np.uint32),
"float": _PlyTypeData(4, "f", np.float32),
"double": _PlyTypeData(8, "d", np.float64),
"int8": _PlyTypeData(1, "b", np.byte),
"uint8": _PlyTypeData(1, "B", np.ubyte),
"int16": _PlyTypeData(2, "h", np.short),
"uint16": _PlyTypeData(2, "H", np.ushort),
"int32": _PlyTypeData(4, "i", np.int32),
"uint32": _PlyTypeData(4, "I", np.uint32),
"float32": _PlyTypeData(4, "f", np.float32),
"float64": _PlyTypeData(8, "d", np.float64),
}
_Property = namedtuple("_Property", "name data_type list_size_type")
......@@ -84,9 +92,9 @@ class _PlyElementType:
"""
if not self.is_fixed_size():
return False
first_type = self.properties[0].data_type
first_type = _PLY_TYPES[self.properties[0].data_type]
for property in self.properties:
if property.data_type != first_type:
if _PLY_TYPES[property.data_type] != first_type:
return False
return True
......
......@@ -284,7 +284,7 @@ class TestMeshPlyIO(TestCaseMixin, unittest.TestCase):
format,
"element vertex 8",
"property float x",
"property float y",
"property float32 y",
"property float z",
"element vertex1 8",
"property float x",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment