Commit 34163326 authored by Gil Moshayof's avatar Gil Moshayof Committed by Facebook GitHub Bot
Browse files

Make extend respect subclasses of textures

Summary: 3 extend functions in textures.py updated to call `self.__class__` rather than create a new object of its type. As mentioned in https://github.com/facebookresearch/pytorch3d/issues/618 .

Reviewed By: bottler

Differential Revision: D28281218

fbshipit-source-id: b9c99ab87e46a3f28c37efa1ee2c2dceb560b491
parent d17b121d
......@@ -470,7 +470,7 @@ class TexturesAtlas(TexturesBase):
def extend(self, N: int) -> "TexturesAtlas":
new_props = self._extend(N, ["atlas_padded", "_num_faces_per_mesh"])
new_tex = TexturesAtlas(atlas=new_props["atlas_padded"])
new_tex = self.__class__(atlas=new_props["atlas_padded"])
new_tex._num_faces_per_mesh = new_props["_num_faces_per_mesh"]
return new_tex
......@@ -865,7 +865,7 @@ class TexturesUV(TexturesBase):
"_num_faces_per_mesh",
],
)
new_tex = TexturesUV(
new_tex = self.__class__(
maps=new_props["maps_padded"],
faces_uvs=new_props["faces_uvs_padded"],
verts_uvs=new_props["verts_uvs_padded"],
......@@ -1339,7 +1339,7 @@ class TexturesVertex(TexturesBase):
def extend(self, N: int) -> "TexturesVertex":
new_props = self._extend(N, ["verts_features_padded", "_num_verts_per_mesh"])
new_tex = TexturesVertex(verts_features=new_props["verts_features_padded"])
new_tex = self.__class__(verts_features=new_props["verts_features_padded"])
new_tex._num_verts_per_mesh = new_props["_num_verts_per_mesh"]
return new_tex
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment