Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot 4 crashes when updating a GLTF file's skeleton #74059

Closed
kobligo opened this issue Feb 27, 2023 · 10 comments · Fixed by #83964
Closed

Godot 4 crashes when updating a GLTF file's skeleton #74059

kobligo opened this issue Feb 27, 2023 · 10 comments · Fixed by #83964

Comments

@kobligo
Copy link

kobligo commented Feb 27, 2023

Godot version

v4.0.rc6.official [0cd1483]

System information

Windows 10, Vulkan, RTX3080

Issue description

The Skeleton3D node of a skinned GLTF/GLB/FBX model causes Godot to crash if it's visible in the inspector as the user re-imports the model file with armature changes.

Steps to reproduce

  • Open the included reproduction file.
  • Open the model_inherited.tscn scene.
  • Select the Skeleton3D node so that its bone hierarchy shows up in the inspector.
  • Open the included model.blend file in Blender and alter the bone structure of its armature by entering Edit Mode and moving, adding, removing, or renaming one of its bones. Either of these actions will do the job.
  • Export the armature as GLB, overwriting the existing model.glb in the Godot project.
  • Go back to Godot and watch it crash.

Minimal reproduction project

ArmatureCrashBug.zip

@lobziq
Copy link

lobziq commented Feb 27, 2023

Also crashes if you import directly from .blend file.

@Rindbee
Copy link
Contributor

Rindbee commented Feb 28, 2023

Judging from the crash log, it is somewhat similar to #73765. Both try to perform add_child/remove_child on nodes (especially parent nodes) during propagation.

Crash details
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.rc.custom_build (0bc36c8954328a36295d50dc5f7722c9463f6f5c)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f5c9d667520] (??:0)
[2] Node::remove_child(Node*) (/opt/godot/godot/scene/main/node.cpp:1171)
[3] Skeleton3DEditor::_notification(int) (/opt/godot/godot/editor/plugins/skeleton_3d_editor_plugin.cpp:874)
[4] Skeleton3DEditor::_notificationv(int, bool) (/opt/godot/godot/editor/plugins/skeleton_3d_editor_plugin.h:96)
[5] Object::notification(int, bool) (/opt/godot/godot/core/object/object.cpp:790)
[6] Object::_predelete() (/opt/godot/godot/core/object/object.cpp:196)
[7] predelete_handler(Object*) (/opt/godot/godot/core/object/object.cpp:1825)
[8] void memdelete<Node>(Node*) (/opt/godot/godot/./core/os/memory.h:105)
[9] EditorInspector::_clear(bool) (/opt/godot/godot/editor/editor_inspector.cpp:3325)
[10] EditorInspector::edit(Object*) (/opt/godot/godot/editor/editor_inspector.cpp:3350)
[11] EditorInspector::_node_removed(Node*) (/opt/godot/godot/editor/editor_inspector.cpp:3847)
[12] void call_with_variant_args_helper<EditorInspector, Node*, 0ul>(EditorInspector*, void (EditorInspector::*)(Node*), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/opt/godot/godot/./core/variant/binder_common.h:298)
[13] void call_with_variant_args<EditorInspector, Node*>(EditorInspector*, void (EditorInspector::*)(Node*), Variant const**, int, Callable::CallError&) (/opt/godot/godot/./core/variant/binder_common.h:408)
[14] CallableCustomMethodPointer<EditorInspector, Node*>::call(Variant const**, int, Variant&, Callable::CallError&) const (/opt/godot/godot/./core/object/callable_method_pointer.h:105)
[15] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/opt/godot/godot/core/variant/callable.cpp:51)
[16] Object::emit_signalp(StringName const&, Variant const**, int) (/opt/godot/godot/core/object/object.cpp:1046)
[17] Error Object::emit_signal<Node*>(StringName const&, Node*) (/opt/godot/godot/./core/object/object.h:869)
[18] SceneTree::node_removed(Node*) (/opt/godot/godot/scene/main/scene_tree.cpp:132)
[19] Node::_propagate_exit_tree() (??:?)
[20] Node::_propagate_exit_tree() (/opt/godot/godot/scene/main/node.cpp:289)
[21] Node::_set_tree(SceneTree*) (/opt/godot/godot/scene/main/node.cpp:2595)
[22] Node::remove_child(Node*) (/opt/godot/godot/scene/main/node.cpp:1203)
[23] EditorNode::reload_instances_with_path_in_edited_scenes(String const&) (/opt/godot/godot/editor/editor_node.cpp:6091)
[24] EditorNode::_resources_reimported(Vector<String> const&) (/opt/godot/godot/editor/editor_node.cpp:1017)
[25] void call_with_variant_args_helper<EditorNode, Vector<String> const&, 0ul>(EditorNode*, void (EditorNode::*)(Vector<String> const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/opt/godot/godot/./core/variant/binder_common.h:293)
[26] void call_with_variant_args<EditorNode, Vector<String> const&>(EditorNode*, void (EditorNode::*)(Vector<String> const&), Variant const**, int, Callable::CallError&) (/opt/godot/godot/./core/variant/binder_common.h:408)
[27] CallableCustomMethodPointer<EditorNode, Vector<String> const&>::call(Variant const**, int, Variant&, Callable::CallError&) const (/opt/godot/godot/./core/object/callable_method_pointer.h:105)
[28] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/opt/godot/godot/core/variant/callable.cpp:51)
[29] Object::emit_signalp(StringName const&, Variant const**, int) (/opt/godot/godot/core/object/object.cpp:1046)
[30] Error Object::emit_signal<Vector<String> >(StringName const&, Vector<String>) (/opt/godot/godot/./core/object/object.h:869)
[31] EditorFileSystem::reimport_files(Vector<String> const&) (/opt/godot/godot/editor/editor_file_system.cpp:2326)
[32] EditorFileSystem::_update_scan_actions() (/opt/godot/godot/editor/editor_file_system.cpp:689)
[33] EditorFileSystem::_notification(int) (/opt/godot/godot/editor/editor_file_system.cpp:1260)
[34] EditorFileSystem::_notificationv(int, bool) (/opt/godot/godot/editor/editor_file_system.h:146)
[35] Object::notification(int, bool) (/opt/godot/godot/core/object/object.cpp:790)
[36] SceneTree::_notify_group_pause(StringName const&, int) (/opt/godot/godot/scene/main/scene_tree.cpp:874)
[37] SceneTree::process(double) (/opt/godot/godot/scene/main/scene_tree.cpp:466)
[38] Main::iteration() (/opt/godot/godot/main/main.cpp:3161)
[39] OS_LinuxBSD::run() (/opt/godot/godot/platform/linuxbsd/os_linuxbsd.cpp:880)
[40] /opt/godot/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(main+0x1fe) [0x55ae801ee82e] (/opt/godot/godot/platform/linuxbsd/godot_linuxbsd.cpp:73)
[41] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f5c9d64ed90] (??:0)
[42] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f5c9d64ee40] (??:0)
[43] /opt/godot/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(_start+0x25) [0x55ae801ee565] (??:?)
-- END OF BACKTRACE --
================================================================

handles_mesh_instance->get_parent()->remove_child(handles_mesh_instance);

@Xyotic
Copy link

Xyotic commented May 7, 2023

Might be related:
I noticed that in more complex skeletons, if you reimport them with new additional bones, the skeletons of inherited scenes will get corrupted.
Cant point my finger on it what causes it, since it doesn't seem to happen on simpler skeletons.

@someThrowAway1900
Copy link

Same/similar issue after updating the bone, mesh, etc in blender, but godot crashes only when I click on the skeleton node in the editor.

  • overwrite the existing glb file in the godot project
  • in the editor, right click the glb and select new inherited scene
  • click the Root, Armature, Cube or AnimationPlayer nodes and it works as expected
  • click the skeleton3D node and godot crashes

This happens in 4.0.3 rc2, but not in 4.0.2 stable

@akien-mga
Copy link
Member

@someThrowAway1900 That's a different issue: #77046.

@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 23, 2023
@fire
Copy link
Member

fire commented Aug 24, 2023

I've been looking into the bug and found a possible fix. It seems like if we get rid of control point meshes, the crashes stop. You can check out what I did in this branch:

avoid-skeleton-crash

So, my suggestion is to move handles from MeshInstance3D over to the official subgizmos system. This should help us steer clear of the skeleton crash problem in the future.

@kobligo
Copy link
Author

kobligo commented Oct 2, 2023

Hey, uh, so what's the next step? This is a pretty severe issue I think.
I built an editor with the above fix, and I wasn't able to reproduce the crash anymore.
Does that mean this could get merged, @fire ?

On a side note, reimporting the model.glb file in my test project produced a new error message:
Attempt to disconnect a nonexistent connection from 'model:<Node3D#3209196269378>'. Signal: 'replacing_by', callable: 'EditorNode::set_edited_scene'.
It's not related to this commit, but I thought I'd mention it anyway.
The error appears once per every open scene that inherits from model.glb.

@fire
Copy link
Member

fire commented Oct 2, 2023

@TokageItLab any suggested fix?

@rcorre
Copy link
Contributor

rcorre commented Oct 2, 2023

@kobligo #81695 may fix the signal warning.

I'm happy to look at the subgizmo fix this week if it seems like the right approach and nobody else is planning to work on it.

@kobligo
Copy link
Author

kobligo commented Oct 2, 2023

@kobligo #81695 may fix the signal warning.

I'm afraid the issue persists even in my very latest master branch build from today, unless I'm doing something wrong here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.