Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.62k stars 246 forks source link

Godot crashes when importing .vox file #601

Open beicause opened 7 months ago

beicause commented 7 months ago

Describe the bug When project contains .vox file, godot automatically imports it and crashes.

To Reproduce Open a project that contains .vox file.

Expected behavior It shouldn't crash

Screenshots The console log:

ERROR: Unimplemented _get_import_order in add-on.
   at: get_import_order (editor/import/editor_import_plugin.cpp:112)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.2.rc.custom_build (474589eb838623f4a59628c0316d0d27f83ed3d1)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7fb9e45a9520] (??:0)
[2] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0xfbf879] (??:0)
[3] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x15b529f] (??:0)
[4] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x15ba2bd] (??:0)
[5] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x15c3d9f] (??:0)
[6] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x15c51ff] (??:0)
[7] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x3f73268] (??:0)
[8] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x24eaeb4] (??:0)
[9] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x253d59b] (??:0)
[10] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x253de41] (??:0)
[11] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x482d69] (??:0)
[12] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x4200e8] (??:0)
[13] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7fb9e4590d90] (??:0)
[14] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7fb9e4590e40] (??:0)
[15] /home/luo/Dowload/godot.linuxbsd.editor.x86_64() [0x431dca] (??:0)
-- END OF BACKTRACE --
================================================================

Environment Godot v4.2.2.rc (474589eb8) - Linux Mint 21.3 (Virginia) - X11 - Vulkan (Mobile) - integrated AMD Unknown (RADV RENOIR) () - AMD Ryzen 7 4800U with Radeon Graphics (16 Threads)

Zylann commented 7 months ago

Eww given the error printed I wonder if that's actually a Godot bug, which nobody noticed because so few people make custom importers... That backtrace is useless unfortunately, it has no information about where the crash happened. Also it may be useful to provide the .vox file you used, because it could also be related to what this one specifically contains.

beicause commented 7 months ago

https://github.com/Zylann/godot_voxel/blob/30b8d6307e3159d5118c7dc7db2fa4f2bd21e6f9/util/godot/classes/editor_import_plugin.h#L94 I guess the reason is get_import_order isn't implemented.

The error is from: https://github.com/godotengine/godot/blob/4ce5e261b31566f06b457f402488b6a26baa7fd1/editor/import/editor_import_plugin.cpp#L112

Zylann commented 7 months ago

I know, but if that error is actually what causes Godot to crash, then that's also a Godot bug. Godot must never crash if possible even if there is an error like this (someone could write a GDScript importer and crash the engine which is pretty bad). But having the .vox file would help to figure out if the crash really happens in Godot or in the importer.

Zylann commented 6 months ago

I just tried importing monu1.vox, a file provided by default in MagicaVoxel. The error printed, but it didn't crash, and the model shows up properly: image

So you will have to provide the vox file or project you used, because it probably contains something the importer didn't handle.

MountainLabsYT commented 3 months ago

Are you using a C++ voxel importer? because in the current state of godot, Vox files will crash the game 9/10 times. Don't ask why they just do. this isn't a problem with the godot voxel engine

Zylann commented 3 months ago

having the .vox file would help to figure out if the crash really happens in Godot or in the importer.

you will have to provide the vox file or project you used, because it probably contains something the importer didn't handle.

Please provide a minimal project and instructions to reproduce, because as I already said, I tried importing a vox file on my computer and it worked fine. This module is entirely in C++, but the import pipeline is from Godot. Until figured out, that crash could come from either side.

beicause commented 3 months ago

The .vox file was exported with https://github.com/vengi-voxel/vengi. Maybe its .vox format isn't compatible with the importer of this module.

Zylann commented 3 months ago

Well either way, if someone has an issue importing some files, I need to be able to test them to see what's going on, and if any, I'd like to know what kind of special things happen with those files. It could be an unhandled format difference, could be the model is too big, could be Godot bug, could be module bug... it's still all speculation because nobody sent me a test case. I just opened the Vengi web version, added some cubes, exported to vox, dropped into Godot and it loaded fine. The module only implements what's described in this specification: https://github.com/ephtracy/voxel-model/blob/master/MagicaVoxel-file-format-vox.txt