Skip to content

Commit b1ff9d9

Browse files
Krzysztof Chalupkafacebook-github-bot
Krzysztof Chalupka
authored andcommitted
Disallow None vertex/face lists in texture submeshing
Summary: In order to simplify the interface, we disallow passing None as vertex/face lists to textures.submeshes. This function would only ever get called from within meshes.submeshes where we can provide both arguments, even if they're not necessary for a specific submesh type. Reviewed By: bottler Differential Revision: D35581161 fbshipit-source-id: aeab99308a319b144e141ca85ca7515f855116da
1 parent 22f8607 commit b1ff9d9

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

pytorch3d/renderer/mesh/textures.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ def sample_textures(self) -> torch.Tensor:
244244

245245
def submeshes(
246246
self,
247-
vertex_ids_list: Optional[List[List[torch.LongTensor]]],
248-
faces_ids_list: Optional[List[List[torch.LongTensor]]],
247+
vertex_ids_list: List[List[torch.LongTensor]],
248+
faces_ids_list: List[List[torch.LongTensor]],
249249
) -> "TexturesBase":
250250
"""
251251
Extract sub-textures used for submeshing.
@@ -1477,8 +1477,8 @@ def sample_textures(self, fragments, faces_packed=None) -> torch.Tensor:
14771477

14781478
def submeshes(
14791479
self,
1480-
vertex_ids_list: Optional[List[List[torch.LongTensor]]],
1481-
faces_ids_list: Optional[List[List[torch.LongTensor]]],
1480+
vertex_ids_list: List[List[torch.LongTensor]],
1481+
faces_ids_list: List[List[torch.LongTensor]],
14821482
) -> "TexturesVertex":
14831483
"""
14841484
Extract a sub-texture for use in a submesh.
@@ -1502,9 +1502,7 @@ def submeshes(
15021502
sum(len(vertices) for vertices in vertex_ids_list). Each element contains
15031503
vertex features corresponding to the subset of vertices in that submesh.
15041504
"""
1505-
if vertex_ids_list is None or len(vertex_ids_list) != len(
1506-
self.verts_features_list()
1507-
):
1505+
if len(vertex_ids_list) != len(self.verts_features_list()):
15081506
raise IndexError(
15091507
"verts_features_list must be of " "the same length as vertex_ids_list."
15101508
)

0 commit comments

Comments
 (0)