diff options
| author | Yuri Sizov <yuris@humnom.net> | 2023-09-06 14:49:06 +0200 |
|---|---|---|
| committer | Yuri Sizov <yuris@humnom.net> | 2023-09-06 14:49:06 +0200 |
| commit | 356624ce6d59682fa874487bbad43fe163d4ed42 (patch) | |
| tree | 947654c258c50693b7eeacaec535ccb4a9b133f3 /modules/gltf | |
| parent | 3c63dce3cd19f1cc7540418f9a45e4c38e78994e (diff) | |
| parent | 908716529ded3de07bc9936a0d89ef90b4ef4236 (diff) | |
| download | redot-engine-356624ce6d59682fa874487bbad43fe163d4ed42.tar.gz | |
Merge pull request #80807 from aaronfranke/gltf-skin-mesh-comment
GLTF: Add a comment for skinned mesh tree placement
Diffstat (limited to 'modules/gltf')
| -rw-r--r-- | modules/gltf/gltf_document.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 74de40e901..984052d2ca 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -5802,10 +5802,14 @@ void GLTFDocument::_generate_scene_node(Ref<GLTFState> p_state, const GLTFNodeIn // If none of our GLTFDocumentExtension classes generated us a node, we generate one. if (!current_node) { if (gltf_node->skin >= 0 && gltf_node->mesh >= 0 && !gltf_node->children.is_empty()) { + // GLTF specifies that skinned meshes should ignore their node transforms, + // only being controlled by the skeleton, so Godot will reparent a skinned + // mesh to its skeleton. However, we still need to ensure any child nodes + // keep their place in the tree, so if there are any child nodes, the skinned + // mesh must not be the base node, so generate an empty spatial base. current_node = _generate_spatial(p_state, p_node_index); Node3D *mesh_inst = _generate_mesh_instance(p_state, p_node_index); mesh_inst->set_name(gltf_node->get_name()); - current_node->add_child(mesh_inst, true); } else if (gltf_node->mesh >= 0) { current_node = _generate_mesh_instance(p_state, p_node_index); |
