Skip to content

Commit b13c96b

Browse files
committed
Merge pull request #104713 from aaronfranke/gltf-post-convert
GLTF: Fix `export_post_convert` not running for multi-root scenes
2 parents 2ba5168 + 38ba5f5 commit b13c96b

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

modules/gltf/gltf_document.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8554,18 +8554,16 @@ Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> p_state, uint
85548554
// Add the root node(s) and their descendants to the state.
85558555
if (_root_node_mode == RootNodeMode::ROOT_NODE_MODE_MULTI_ROOT) {
85568556
const int child_count = p_node->get_child_count();
8557-
if (child_count > 0) {
8558-
for (int i = 0; i < child_count; i++) {
8559-
_convert_scene_node(state, p_node->get_child(i), -1, -1);
8560-
}
8561-
state->scene_name = p_node->get_name();
8562-
return OK;
8557+
for (int i = 0; i < child_count; i++) {
8558+
_convert_scene_node(state, p_node->get_child(i), -1, -1);
85638559
}
8560+
state->scene_name = p_node->get_name();
8561+
} else {
8562+
if (_root_node_mode == RootNodeMode::ROOT_NODE_MODE_SINGLE_ROOT) {
8563+
state->extensions_used.append("GODOT_single_root");
8564+
}
8565+
_convert_scene_node(state, p_node, -1, -1);
85648566
}
8565-
if (_root_node_mode == RootNodeMode::ROOT_NODE_MODE_SINGLE_ROOT) {
8566-
state->extensions_used.append("GODOT_single_root");
8567-
}
8568-
_convert_scene_node(state, p_node, -1, -1);
85698567
// Run post-convert for each extension, in case an extension needs to do something after converting the scene.
85708568
for (Ref<GLTFDocumentExtension> ext : document_extensions) {
85718569
ERR_CONTINUE(ext.is_null());

0 commit comments

Comments
 (0)