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

glTF nodes which are Skeleton bones with meshes are broken and crash #49118

Closed
lyuma opened this issue May 26, 2021 · 1 comment
Closed

glTF nodes which are Skeleton bones with meshes are broken and crash #49118

lyuma opened this issue May 26, 2021 · 1 comment

Comments

@lyuma
Copy link
Contributor

lyuma commented May 26, 2021

Godot version:
4.0.dev 45d3b96
3.3.2-stable and below

OS/device including version:
Windows 10.0.19041.985

Issue description:
This is kind of an oddball case in glTF, but the spec does not forbid a node with mesh, lights or cameras from being used in a skeleton and possibly having itself as a bone in that same skeleton, or being a bone in another skeleton.

I ran into a real world case where a glTF 2.0 model created from UniGLTF exhibited this issue.

Additionally, there appear to exist cases in which a valid glTF file causes Godot to generate two skeletons parented to each other, which occurs in these files. As the Skeletons are arbitrary, this is arguably a separate Godot bug, but it's hard to analyze the DisjointSet code. It is easier to just permit two nested skeletons.

The bugs here in 3.x currently lead to crashes in constructing animation tracks if these nodes are animated, because the nodes were not all generated:

			node_path = ap->get_parent()->get_path_to(state.scene_nodes.find(node_index)->get());

Here are some of the errors that the attached project runs into:

ERROR: glTF: Generating scene detected direct parented Skeletons
   at: (modules\gltf\gltf_document.cpp:5441)
ERROR: Unable to cast node 13 of type Skeleton3D to EditorSceneImporterMeshNode3D
   at: (modules\gltf\gltf_document.cpp:5987)
ERROR: Unable to find node 32
   at: (modules\gltf\gltf_document.cpp:5984)
ERROR: Node::get_path_to: Condition "!common_parent" is true. Returned: NodePath()
   At: scene\main\node.cpp:1612

I have a patch prepared for master in PR #48915 (and 3.x backport pending)

Expected output, after applying the 3.x patch (these models are validated and the expected output can be confirmed with Three.js, Windows and Blender):

godot_gltf_expected_output.mp4

Steps to reproduce:

  1. Open the project
  2. The animations should automatically play
  3. Due to another issue related to animations, Godot 3.x crashes. However, if the offending glb files are removed, it will be missing meshes and have errors.

Minimal reproduction project:
gltf_test_v3x.zip
gltf_test_vmaster.zip

@akien-mga
Copy link
Member

Fixed by #48915.

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

No branches or pull requests

3 participants