V-Sekai/unidot_importer

Assets being mixed up

Closed this issue · 3 comments

Hey,

Thanks for making this it's really a nice initiative.

For fun I'm trying to port a game jam project to Godot but when running the addon at version 8a5956c (and prior versions) some of the assets get replaced by others, I'm not sure exactly why and I was wondering if there was anything I could do to help you fix it? more logs patching etc. One of the object is being used everywhere.

image

PS: Not sure if that's any interest to you but a friend of mind made a Godot C# => GDScript converter using Roslyn, might serve as base for a Unity => Godot C# => GDscript https://github.com/seb776/CSToGDScript

lyuma commented

I'd need to see a bit more of the scene to understand what's going on. Also, are there any errors being produced by the import process (in Project -> Tools -> SHow last import logs)

Is there some way you could share the assets with me using DM on discord (username lyuma) or email? If you could, then I'd be happy to investigate

Sent you a DM on Discord with the unity package! Hope it helps.

lyuma commented

I am finally proud to say that we have fully understood and worked around the underlying issue here. Thanks to your project I was able to track down the issue in Godot Engine to a cached int cpos variable in EditorFileSystem::_reimport_file that doesn't account for the Advanced Importer to extract materials, meshes and animations into the same directory, since it is calculated before the importer ran and reused afterwards to store the "uid", which is what was getting mixed up.

While this is an engine bug, it only affects specific cases: First, it only affects files that are written to the exact same directory as the gltf. Therefore, I was able to workaround the issue by extracting meshes, materials and animations instead into a subdirectory "extracted", which is what the latest version of Unidot does.
Second, the Godot Engine bug only affected gltf files which start with the letters "r" through "z"... and as luck would have it, a lot of the files in your project start with the word "zone", which made it much easier to identify and reproduce the issue. Funny, isn't it!

The project also helped identify a lot of math and hashing issues which led to positions and scales being wrong, so the hands-on debugging of a "Real World" project really paid off. Thanks.

I'll close the issue. If you run into more trouble on the latest version, it would be best to start a new issue.