1
0
Fork 0

Merge pull request #103332 from aaronfranke/gltf-no-orphans

GLTF: Use scene root nodes for root nodes, don't include orphan nodes
This commit is contained in:
Rémi Verschelde 2025-06-10 12:29:33 +02:00
commit aa0eb50d45
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 8 additions and 3 deletions

View File

@ -690,7 +690,9 @@ Error GLTFDocument::_parse_nodes(Ref<GLTFState> p_state) {
}
void GLTFDocument::_compute_node_heights(Ref<GLTFState> 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<GLTFNode> node = p_state->nodes[node_i];
node->height = 0;
@ -704,8 +706,11 @@ void GLTFDocument::_compute_node_heights(Ref<GLTFState> 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);
}
}
}
}