Skip to content

Commit

Permalink
Merge pull request #352 from mmatl/master
Browse files Browse the repository at this point in the history
Fix small issues with DAE and GLB mats
  • Loading branch information
mikedh committed Mar 22, 2019
2 parents b10de27 + b74fc86 commit f00158c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion trimesh/exchange/dae.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def _parse_node(node,

# Get UV coordinates if possible
vis = None
if colors is None and primitive.material in local_material_map:
if primitive.material in local_material_map:
material = copy.copy(
local_material_map[primitive.material])
uv = None
Expand Down
11 changes: 5 additions & 6 deletions trimesh/exchange/gltf.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,17 +783,16 @@ def _read_buffers(header, buffers, mesh_kwargs):
kwargs["vertices"] = access[p["attributes"]["POSITION"]]

# do we have UV coordinates
if "TEXCOORD_0" in p["attributes"]:
if "material" not in p:
log.warning("texcoord without material!")
else:
if "material" in p:
uv = None
if "TEXCOORD_0" in p["attributes"]:
# flip UV's top- bottom to move origin to lower-left:
# https://github.com/KhronosGroup/glTF/issues/1021
uv = access[p["attributes"]["TEXCOORD_0"]].copy()
uv[:, 1] = 1.0 - uv[:, 1]
# create a texture visual
kwargs["visual"] = visual.texture.TextureVisuals(
uv=uv, material=materials[p["material"]])
kwargs["visual"] = visual.texture.TextureVisuals(
uv=uv, material=materials[p["material"]])

# create a unique mesh name per- primitive
if "name" in m:
Expand Down

0 comments on commit f00158c

Please sign in to comment.