mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
GLTF: Use scene root nodes for root nodes, don't include orphan nodes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user