diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index dd155454b0a..06a069276ed 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -690,7 +690,9 @@ Error GLTFDocument::_parse_nodes(Ref p_state) { } void GLTFDocument::_compute_node_heights(Ref p_state) { - p_state->root_nodes.clear(); + if (_naming_version < 2) { + p_state->root_nodes.clear(); + } for (GLTFNodeIndex node_i = 0; node_i < p_state->nodes.size(); ++node_i) { Ref node = p_state->nodes[node_i]; node->height = 0; @@ -704,8 +706,11 @@ void GLTFDocument::_compute_node_heights(Ref p_state) { current_i = parent_i; } - if (node->height == 0) { - p_state->root_nodes.push_back(node_i); + if (_naming_version < 2) { + // This is incorrect, but required for compatibility with previous Godot versions. + if (node->height == 0) { + p_state->root_nodes.push_back(node_i); + } } } }