Merge pull request #104713 from aaronfranke/gltf-post-convert

GLTF: Fix `export_post_convert` not running for multi-root scenes
This commit is contained in:
Rémi Verschelde 2025-03-28 14:35:03 +01:00
commit b13c96b097
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -8554,18 +8554,16 @@ Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> p_state, uint
// Add the root node(s) and their descendants to the state.
if (_root_node_mode == RootNodeMode::ROOT_NODE_MODE_MULTI_ROOT) {
const int child_count = p_node->get_child_count();
if (child_count > 0) {
for (int i = 0; i < child_count; i++) {
_convert_scene_node(state, p_node->get_child(i), -1, -1);
}
state->scene_name = p_node->get_name();
return OK;
for (int i = 0; i < child_count; i++) {
_convert_scene_node(state, p_node->get_child(i), -1, -1);
}
state->scene_name = p_node->get_name();
} else {
if (_root_node_mode == RootNodeMode::ROOT_NODE_MODE_SINGLE_ROOT) {
state->extensions_used.append("GODOT_single_root");
}
_convert_scene_node(state, p_node, -1, -1);
}
if (_root_node_mode == RootNodeMode::ROOT_NODE_MODE_SINGLE_ROOT) {
state->extensions_used.append("GODOT_single_root");
}
_convert_scene_node(state, p_node, -1, -1);
// Run post-convert for each extension, in case an extension needs to do something after converting the scene.
for (Ref<GLTFDocumentExtension> ext : document_extensions) {
ERR_CONTINUE(ext.is_null());