Blender-OMSI-Exporter
Blender-OMSI-Exporter copied to clipboard
Uncaught error if texture path exceeds 255 characters
Within an OMSI mesh file strings are limited to 255 characters—this applies both to texture paths and bone names. Vertex group names are limited to 63 characters, so bone names are not an issue; however Blender permits image filepaths to be up to 1023 characters, which makes it possible to enter a filepath that has more than 255 characters after the last texture
folder.
Fortunately attempting to encode a string longer than 255 characters results in a Python exception instead of writing a corrupt mesh file, however it would be better to catch the exception and report a useful error message.
Traceback (most recent call last):
File "io_export_o3d\__init__.py", line 218, in execute
exporter.export(objects, Path(self.filepath))
File "io_export_o3d\exporter.py", line 322, in export
b = meshio.dump(mesh, self._fs)
File "io_export_o3d\meshio.py", line 437, in dump
ba += es(m.texture)
File "io_export_o3d\meshio.py", line 382, in es
return ef(fs._stringLengthFormat, len(s)) + s.encode(fs._stringFormat)
File "io_export_o3d\meshio.py", line 378, in ef
return pack('<' + fmt.fmt, *v)
struct.error: ubyte format requires 0 <= number <= 255