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
This commit is contained in:
Krzysztof Chalupka 2022-04-12 10:46:48 -07:00 committed by Facebook GitHub Bot
parent 22f86072ca
commit b1ff9d9fd4

View File

@ -244,8 +244,8 @@ class TexturesBase:
def submeshes( def submeshes(
self, self,
vertex_ids_list: Optional[List[List[torch.LongTensor]]], vertex_ids_list: List[List[torch.LongTensor]],
faces_ids_list: Optional[List[List[torch.LongTensor]]], faces_ids_list: List[List[torch.LongTensor]],
) -> "TexturesBase": ) -> "TexturesBase":
""" """
Extract sub-textures used for submeshing. Extract sub-textures used for submeshing.
@ -1477,8 +1477,8 @@ class TexturesVertex(TexturesBase):
def submeshes( def submeshes(
self, self,
vertex_ids_list: Optional[List[List[torch.LongTensor]]], vertex_ids_list: List[List[torch.LongTensor]],
faces_ids_list: Optional[List[List[torch.LongTensor]]], faces_ids_list: List[List[torch.LongTensor]],
) -> "TexturesVertex": ) -> "TexturesVertex":
""" """
Extract a sub-texture for use in a submesh. Extract a sub-texture for use in a submesh.
@ -1502,9 +1502,7 @@ class TexturesVertex(TexturesBase):
sum(len(vertices) for vertices in vertex_ids_list). Each element contains sum(len(vertices) for vertices in vertex_ids_list). Each element contains
vertex features corresponding to the subset of vertices in that submesh. vertex features corresponding to the subset of vertices in that submesh.
""" """
if vertex_ids_list is None or len(vertex_ids_list) != len( if len(vertex_ids_list) != len(self.verts_features_list()):
self.verts_features_list()
):
raise IndexError( raise IndexError(
"verts_features_list must be of " "the same length as vertex_ids_list." "verts_features_list must be of " "the same length as vertex_ids_list."
) )