Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedh committed Mar 16, 2020
1 parent 4f2ce8a commit 5805302
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/test_gltf.py
Expand Up @@ -249,12 +249,16 @@ def test_export_custom_attributes(self):
sphere = g.trimesh.primitives.Sphere()
v_count, _ = sphere.vertices.shape

sphere.vertex_attributes['_CustomFloat32Scalar'] = g.np.random.rand(v_count, 1).astype(g.np.float32)
sphere.vertex_attributes['_CustomFloat32Scalar'] = g.np.random.rand(
v_count, 1).astype(
g.np.float32)
sphere.vertex_attributes['_CustomUIntScalar'] = g.np.random.randint(
0, 1000, size=(v_count, 1)
).astype(g.np.uintc)
sphere.vertex_attributes['_CustomFloat32Vec3'] = g.np.random.rand(v_count, 3).astype(g.np.float32)
sphere.vertex_attributes['_CustomFloat32Mat4'] = g.np.random.rand(v_count, 4, 4).astype(g.np.float32)
sphere.vertex_attributes['_CustomFloat32Vec3'] = g.np.random.rand(
v_count, 3).astype(g.np.float32)
sphere.vertex_attributes['_CustomFloat32Mat4'] = g.np.random.rand(
v_count, 4, 4).astype(g.np.float32)

# export as GLB then re-load
r = g.trimesh.load(
Expand All @@ -263,10 +267,15 @@ def test_export_custom_attributes(self):
file_type='glb')

for _, val in r.geometry.items():
assert set(val.vertex_attributes.keys()) == set(sphere.vertex_attributes.keys())
assert set(
val.vertex_attributes.keys()) == set(
sphere.vertex_attributes.keys())
for key in val.vertex_attributes:
is_same = g.np.array_equal(val.vertex_attributes[key], sphere.vertex_attributes[key])
assert is_same == True
is_same = g.np.array_equal(
val.vertex_attributes[key],
sphere.vertex_attributes[key])
assert is_same is True


if __name__ == '__main__':
g.trimesh.util.attach_to_log()
Expand Down

0 comments on commit 5805302

Please sign in to comment.