Skip to content

Commit ab5c69a

Browse files
authored
Merge pull request #240 from wkentaro/skip_mulformed_texture
Skip loading texture information which trimesh cannot handle
2 parents e64fc9d + fa9bf4a commit ab5c69a

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

trimesh/io/wavefront.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy as np
22

3+
from ..constants import log
34
from .. import util
45

56

@@ -86,9 +87,14 @@ def append_mesh():
8687
texture = np.array(current['vt'], dtype=np.float64)
8788
# make sure vertex texture is the right shape
8889
# AKA (len(vertices), dimension)
89-
texture = texture.reshape((len(vertices), -1))
90-
# save vertex texture with correct ordering
91-
loaded['metadata']['vertex_texture'] = texture[vert_order]
90+
try:
91+
texture = texture.reshape((len(vertices), -1))
92+
# save vertex texture with correct ordering
93+
loaded['metadata']['vertex_texture'] = texture[vert_order]
94+
except ValueError:
95+
log.warning(
96+
'Texture information seems broken: %s' % file_obj.name
97+
)
9298

9399
# build face groups information
94100
# faces didn't move around so we don't have to reindex

0 commit comments

Comments
 (0)