emoose / MBINCompiler

Now maintained by monkeyman192: https://github.com/monkeyman192/MBINCompiler
Other
43 stars 69 forks source link

Blender EXML import #65

Open ScavangeR87 opened 8 years ago

ScavangeR87 commented 8 years ago

Got the following error while trying to import certain exml in Blender 2.77

Traceback (most recent call last): File "C:\Users\ScavangeR\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\io_import_exml.py", line 59, in execute vertexData = getFloatList(getProperty(xmlRoot, 'VertexStream')) File "C:\Users\ScavangeR\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\io_import_exml.py", line 32, in getFloatList list.append(float(p.get('value').replace(",", "."))) ValueError: could not convert string to float: 'Non Numérique'

location: :-1

Tried replacing the value 'Non numérique' by 'n. def.' but no change.

ScavangeR87 commented 8 years ago

Just bypassed this issue, manually changing "Non numérique" by "-1" in exml.

Don't know the logic behind this but hope it may help

Atvaark commented 8 years ago

You could help by writing which file had a "NaN"-value.

ScavangeR87 commented 8 years ago

Sur, got it with MODELS\SPACE\SPACESTATION\MODULARPARTS\DOCK\BACK_SECTION.GEOMETRY.MBIN.PC (unpaked from NMSARC.973CACEA.pak) 1st occurence of faulty value @ line 343815

Got the same kind of errors with files giving me a '-infinit' value but can't remember wich one since i bapassed it straight away.

Atvaark commented 8 years ago

This looks like 2 separate issues.

  1. float.ToString and double.ToString should be called with an IFormatProvider to stop NaN/infinite values from being localized. Single.ToString(CultureInfo.InvariantCulture) should do the trick. Tools that read the .exml can then reliably check for NaN/infinite values. (XML serialization/deserialization should also be done with an invariant culture)
  2. NaN half floats don't roundtrip TkGeometryData.cs#L162 converts uint16 0xff00 to a "NaN" float. On the other hand writing Single.NaN will write uint16 0xfe00. I can't check if this has any impact on the game.