-
-
Notifications
You must be signed in to change notification settings - Fork 22.8k
GLTF: Use scene root nodes for root nodes, don't include orphan nodes #103332
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
Conversation
Did you link any sample wrong and correct gltf files? |
@fire The PR contains an example file already. Did you want me to also include a file that is unaffected by this PR? |
556274c
to
b0a231f
Compare
b0a231f
to
5493a50
Compare
Needs discussion in a Godot Engine pipeline meeting |
5493a50
to
000ae4e
Compare
000ae4e
to
24c5852
Compare
I like this... |
@lyuma Sure, we can do that. |
Approved contingent upon adding the compatibility mode check merged in this pr |
24c5852
to
0972db7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Nice fix
In the future, we may want to figure out how to expose the other scenes, perhaps as sub-resources, but this fix is necessary to allow us to further develop gltf scene functionality in the future.
Thanks! |
This fixes a bug noticed by the Blender Project DogWalk team where Godot was including orphan nodes as root nodes. This is incorrect, only the nodes actually indicated as scene root nodes should be used as root nodes. https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#scenes
Luckily the fix was pretty simple, just remove the code that re-assigns top orphan nodes as root nodes. Test file:
In master: Imports both A and B as glTF root nodes as children of the Godot root node (incorrect).
With this PR: Imports only A as the glTF root node as a child of the Godot root node as indicated by the scene (correct).
I also looked into the general root node handling logic. Currently Godot does not correctly handle the case of a file not specifying scenes or scene root nodes, and will error when trying to parse anything that doesn't look like a scene. This will need to be improved for godotengine/godot-proposals#7494, but for this PR I kept things limited to just this bug fix.