ross-g / io_pdx_mesh

Import/Export files for the Clausewitz game engine
GNU General Public License v3.0
88 stars 11 forks source link

Mesh Import Failed: ascii codec can't decode byte 0xfc in position 53 #32

Closed MahdiBaghbani closed 3 years ago

MahdiBaghbani commented 3 years ago

Hi @ross-g, thanks for your amazing Maya plugin, I almost re designed whole Star Wars ship pack 😄

I encounter error on importing several existing mesh files designed by Elratie, seems somehow this designs have more than 7 bit ascii code values, albeit they show perfectly in game.

so I would suggest that maybe this is a problem of python ascii decoder and it might need some tweak to accept these unusual but valid data inputs.

I attach a mesh file with ascii import problem.

mesh_sample.zip

ross-g commented 3 years ago

Should be an easy fix, the encoding type defaults to ascii but that was just a lazy guess on my part as I don't know what PDX actually use.

For example if I change from "ascii" to "latin_1" this file imports fine (the issue is cause by an "ü" character in a name in the file). But I need to know where the file came from first before I change the encoding of my tool to match. Do you know, Is the file exported from a different tool or from the official PDX Maya exporter?

MahdiBaghbani commented 3 years ago

Oh I get it now! it might be a hard coded binding of a .dds file for textures used in the model mesh file instead of doing that dynamically in a .gfx file.

The ü is German word which makes sense because original author of file is Elratie who is from Germany.

about decoding, since all the text in a mesh file format supposed to be ascii ( or you presumed to be ascii as would I ) this happens, but the game decodes the file anyway, I made a test a loaded a .mesh file with Arabic and Russian character file name in it, and game load it too, so my guess is Stellaris is using utf-8 format for decoding a mesh file.

I think utf-8 is backward compatible with ascii and no problem would happen if you switch the decoding scheme.

ross-g commented 3 years ago

Fixed in 0.8 release. (364800cff10bdc822429ec73149cadcb05ef9710)