-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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: Add root node export options and GODOT_single_root
extension
#81851
Conversation
@aaronfranke Said he will write a proposal at the review meeting we had today. |
@fire @lyuma Proposal opened godotengine/godot-proposals#7791 |
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.
Overall looks good. Just concerned that there might be a case where the propagate_call("set_owner") could print an error.
Array args; | ||
args.append(p_scene_root); | ||
current_node->propagate_call(StringName("set_owner"), args); |
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.
An if statement got lost here.
It's important that the call to set_owner
specifically still be guarded with a check that (current_node != p_scene_root)
Otherwise if you call scene_root.set_owner(scene_root)
it will print an error or malfunction.
If you are 100% certain that current_node
is never the same as p_scene_root
in any of the 3 export modes, it would help if you wrote an explanation because it feels like it could happen especially in the single root case.
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.
It wasn't lost, just changed. It won't ever happen because p_scene_root
will either be null or different from current_node
. When generating the scene root node, we pass in null
to this function.
I already have a comment above "If the root node argument is null, this is the root node", is this not enough?
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.
Not gonna lie, this may very well come in handy later for me heheheh
I can confirm it working on Windows 10.
cea6caa
to
446893f
Compare
Thanks! |
GODOT_single_root
extension
@aaronfranke Do you think it'll be doable to write a gltf spec for |
@fire I have already done this: KhronosGroup/glTF#2329 |
Solves godotengine/godot-proposals#6588
Spec: KhronosGroup/glTF#2329
This PR adds root node export options and a new glTF extension called
GODOT_single_root
.This was discussed with @lyuma about 2 months ago, but was on hold for most of that time due to me waiting for other PRs to be merged as prerequisites (and me not wanting to open draft PRs with a long dependency chain).
(with this PR by itself, there is no export settings dialog, but it can be set through GDScript code when exporting from script, and the goal is to make this available in the export settings once that's added)
GODOT_single_root
glTF extension. This will be parsed the same as Keep Root if the implementation does not supportGODOT_single_root
.The last 2 options both use only vanilla glTF features. Keep Root is the same as 4.1. Multi Root is a new feature, which allows round-tripping a scene without an extra root node, but the downside is that the root node will only ever be a Node3D because the Godot scene's root node is only being saved as a name instead of a node.
The first option, Single Root, uses the
GODOT_single_root
extension. This extension has no data, it is only a flag with rules and restrictions. Single Root is identical to Keep Root except that it adds this one string to the"extensionsUsed"
array to mark it as the single root node. Godot will read this flag and set the glTF root as the single root node of the generated Godot scene. This flag will do nothing in implementations that don't support it, so in those cases it behaves identically to exporting with Keep Root, and exporting in 4.1 and earlier.