Skip to content

Commit 38ba5f5

Browse files
committed
GLTF: Fix export_post_convert not running for multi-root scenes
1 parent 594d64e commit 38ba5f5

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
@@ -8552,18 +8552,16 @@ Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> p_state, uint
85528552
// Add the root node(s) and their descendants to the state.
85538553
if (_root_node_mode == RootNodeMode::ROOT_NODE_MODE_MULTI_ROOT) {
85548554
const int child_count = p_node->get_child_count();
8555-
if (child_count > 0) {
8556-
for (int i = 0; i < child_count; i++) {
8557-
_convert_scene_node(state, p_node->get_child(i), -1, -1);
8558-
}
8559-
state->scene_name = p_node->get_name();
8560-
return OK;
8555+
for (int i = 0; i < child_count; i++) {
8556+
_convert_scene_node(state, p_node->get_child(i), -1, -1);
85618557
}
8558+
state->scene_name = p_node->get_name();
8559+
} else {
8560+
if (_root_node_mode == RootNodeMode::ROOT_NODE_MODE_SINGLE_ROOT) {
8561+
state->extensions_used.append("GODOT_single_root");
8562+
}
8563+
_convert_scene_node(state, p_node, -1, -1);
85628564
}
8563-
if (_root_node_mode == RootNodeMode::ROOT_NODE_MODE_SINGLE_ROOT) {
8564-
state->extensions_used.append("GODOT_single_root");
8565-
}
8566-
_convert_scene_node(state, p_node, -1, -1);
85678565
// Run post-convert for each extension, in case an extension needs to do something after converting the scene.
85688566
for (Ref<GLTFDocumentExtension> ext : document_extensions) {
85698567
ERR_CONTINUE(ext.is_null());

0 commit comments

Comments
 (0)