GLTF: Duplicate extensions at the start of the import and export process#116789
Open
aaronfranke wants to merge 1 commit intogodotengine:masterfrom
Open
GLTF: Duplicate extensions at the start of the import and export process#116789aaronfranke wants to merge 1 commit intogodotengine:masterfrom
aaronfranke wants to merge 1 commit intogodotengine:masterfrom
Conversation
7eb38da to
021d58e
Compare
lyuma
reviewed
Mar 7, 2026
Contributor
lyuma
left a comment
There was a problem hiding this comment.
Looks good, just want to move the duplicate a bit earlier to completely avoid any possible of thread safety issues
We should update the line of the documentation in GLTFDocumentExtension.xml to explain that GLTFDocumentExtension instances are duplicated at the beginning of a parse or export.
modules/gltf/gltf_document.cpp
Outdated
| err = ext->import_preflight(p_state, p_state->json["extensionsUsed"]); | ||
| if (err == OK) { | ||
| document_extensions.push_back(ext); | ||
| document_extensions.push_back(ext->duplicate()); |
Contributor
There was a problem hiding this comment.
do the duplicate before, so import_preflight is also thread safe. They are refcounted, so they will be easily deleted if they are not used.
modules/gltf/gltf_document.cpp
Outdated
| Error err = ext->export_preflight(state, p_node); | ||
| if (err == OK) { | ||
| document_extensions.push_back(ext); | ||
| document_extensions.push_back(ext->duplicate()); |
Contributor
There was a problem hiding this comment.
do the duplicate before the export_preflight
021d58e to
89741d5
Compare
lyuma
approved these changes
Mar 7, 2026
Contributor
lyuma
left a comment
There was a problem hiding this comment.
This looks great. Approved in meeting
89741d5 to
f205173
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR was made in response to multi-threading concerns from @lyuma regarding multiple GLTFDocument instances accessing the same GLTFDocumentExtension classes.