OBJ Importer does not support backslash as line continuation

Seems that at least some of the .OBJ format descriptions declare that a backslash should be legal as a line continuation character to break up long lines:

http://www.fileformat.info/format/wavefrontobj/egff.htm

The Rhino3D .OBJ export uses this, so any exported file is typically full of backslash-breaked long lines.

There any way this could be included to the .OBJ importer so one does not have to manually edit out the backslashes? Currently the import will fail when encountering a backslash.

1 Like

Hi

I’ve just looked at the source code:
OBJLoader

There are several ways of removing this limitation:

  • do what you currently do manually in load(AssetInfo) before creating the scanner, it would increase a lot the memory footprint whereas there are tons of obj files without backslash
  • override the scanner so that it treats several consecutive lines ended with a backslash and the next one as a single line, it wouldn’t increase the memory footprint and it would avoid invasive changes in the current code
  • don’t use a scanner, use a BufferedReader, treat the backslash very early like here

My third suggestion is the easiest and most efficient one. I suggest you to write a patch and to provide an example of obj file. Good luck.