Files
pytorch3d/tests
Raashish Aggarwal 8b3ba6ede4 Accept tab-separated lines in load_obj (#2061)
Summary:
`load_obj` recognizes vertex, texture, normal and face lines with `line.startswith("v ")`, `"vt "`, `"vn "` and `"f "`. The OBJ format separates fields with any whitespace, and some exporters write a tab after the keyword. Those lines are skipped without any error, so the mesh silently loses vertices and faces:

```python
from io import StringIO
from pytorch3d.io import load_obj

verts, faces, _ = load_obj(StringIO("v\t0 0 0\nv 1 0 0\nv 0 1 0\nf\t1 2 3\n"))
verts.shape, faces.verts_idx.shape
# before: (2, 3), (0, 3)   after: (3, 3), (1, 3)
```

This dispatches on the first token of the already split line (`tokens[:1] == ["v"]`), the same way the `usemtl` branch already does.

Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/2061

Test Plan: added `test_load_obj_tab_separated` to `tests/test_io_obj.py`, using tabs in `v`, `vt`, `vn` and `f` lines. It fails on main and passes with the change. I ran `tests/test_io_obj.py` on Windows without the C++ extension: the same 19 tests fail before and after (they reopen a `NamedTemporaryFile` or need `_C`), and the rest pass. flake8 is clean on the changed lines.

Reviewed By: MichaelRamamonjisoa

Differential Revision: D124656223

Pulled By: bottler

fbshipit-source-id: ab0ef3dc0f3c998c44874e6a416e6a9649f29378
2026-10-19 14:36:14 -07:00
..
2022-01-04 11:43:38 -08:00
2025-08-27 06:55:50 -07:00
2022-05-25 06:16:03 -07:00
2025-07-10 05:20:22 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2024-02-16 08:19:12 -08:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2024-11-20 09:15:51 -08:00
2024-11-06 11:13:59 -08:00
2025-08-27 06:55:50 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2025-10-09 08:17:20 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2025-08-27 06:55:50 -07:00
2025-08-27 06:55:50 -07:00
2022-05-25 06:16:03 -07:00
2022-05-25 06:16:03 -07:00
2025-09-04 08:31:32 -07:00
2024-03-12 06:59:31 -07:00
2023-01-25 01:56:36 -08:00
2020-01-23 11:53:46 -08:00