Improve GLTF export logic for scene root nodes #79801
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
GLTFDocument::_convert_scene_node
writing data into the JSON array for the scene root node. At this stage of the export process, it is not appropriate to touch the JSON yet, in fact the data that was being written here was being ignored and overwritten. Instead, it now writes the root node top_state->root_nodes
.GLTFDocument::_serialize_scenes
to no longer be hard-coded for a single root node. Now it just uses whatever data was given to it inp_state->root_nodes
.GLTFDocument::_serialize_scenes
to have the failure condition at the top with a message, instead of having it checkif (p_state->nodes.size()) {
and return invalid data if false.export_preflight
andconvert_scene_node
so that the buffer is available to be used in those steps.r_state
vsp_state
in the headers vs the cpp (I usedr_state
, let me know ifp_state
is preferred instead and I can change it to be consistentlyp_state
).This PR should not change behavior except that
p_state->root_nodes
and the buffer are now populated during export, and there will not be data prematurely written to JSON and overwritten later.