godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.3k stars 19.99k forks source link

`ArrayMesh` text resources always saved as binary #61206

Closed Lauson1ex closed 4 weeks ago

Lauson1ex commented 2 years ago

Godot version

3.4.4-stable

System information

Windows 10

Issue description

I use the ResourceSaver to save meshes as text for debugging when I suspect that meshes are not being imported correctly from the DCC. Upon investigation, it turns out that text resources (.tres) are now being saved as binary, even when explicitly telling ArrayMesh to NOT use compression on method add_surface_from_arrays (compress_flags = 0) and ResourceSaver's save method (flags = 0).

The thing is, it wasn't like this a few versions ago.

Saving a single vertex, such as Vector3(-1.0, 0.0, 1.0), would result in a .tres file with:

...
"array_vertex_data": PoolVector3Array( Vector3( -1.0, 0.0, 1.0)),
...

Now, it yields:

...
"array_data": PoolByteArray( 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 128, 63 ),
...

Converting to hex, that is clearly 0xbf800000, 0x00000000 and 0x3f800000, which are the hex-float IEEE 754 representations of -1.0, 0.0 and 1.0 respectively.

Text resources were supposed to be human-readable, and to a certain point they were. I even tried on 3.5-rc1, but the issue is still present.

Steps to reproduce

I've included a mrp below. Just extract it and run. It should create and save a buggy_mesh.tres ArrayMesh text resource file on the project's root folder.

Minimal reproduction project

array_mesh_resource_saver_bug.zip

Calinou commented 2 years ago

Upon investigation, it turns out that text resources (.tres) are now being saved as binary

Which Godot version was the first one to exhibit this new behavior? Please test Godot older stable releases like 3.3.4, then all 3.4 betas and RCs (you can find them here).

AThousandShips commented 4 weeks ago

Closing due to lack of response, if you provide the requested information this can be reopened