mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-25 08:40:35 +08:00
getitem for textures
Summary: Make Meshes.__getitem__ carry texture information to the new mesh. Reviewed By: gkioxari Differential Revision: D20283976 fbshipit-source-id: d9ee0580c11ac5b4384df9d8158a07e6eb8d00fe
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5a1d7143d8
commit
fb97ab104e
@@ -415,10 +415,12 @@ class Meshes(object):
|
||||
else:
|
||||
raise IndexError(index)
|
||||
|
||||
textures = None if self.textures is None else self.textures[index]
|
||||
|
||||
if torch.is_tensor(verts) and torch.is_tensor(faces):
|
||||
return Meshes(verts=[verts], faces=[faces])
|
||||
return Meshes(verts=[verts], faces=[faces], textures=textures)
|
||||
elif isinstance(verts, list) and isinstance(faces, list):
|
||||
return Meshes(verts=verts, faces=faces)
|
||||
return Meshes(verts=verts, faces=faces, textures=textures)
|
||||
else:
|
||||
raise ValueError("(verts, faces) not defined correctly")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user