summaryrefslogtreecommitdiff
path: root/modules/gltf
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-27 11:24:34 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-27 11:24:34 +0100
commit8b662c763e27b8dbbda21bde0694151c718aa725 (patch)
tree1cf54fb1aa2b165b20c368903e463f838c5a85da /modules/gltf
parent3e1925fd0009fcc871e0a9d40dd9a9edc6419669 (diff)
parent3f4ea98b34f697e8cece0df506d76bd30d51338e (diff)
Merge pull request #72162 from lyuma/skeleton_rename
Make BoneAttachment3D and Skeleton3D names consistent.
Diffstat (limited to 'modules/gltf')
-rw-r--r--modules/gltf/gltf_document.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index 7a3ba6ceb1..8294336dda 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -543,6 +543,7 @@ String GLTFDocument::_gen_unique_bone_name(Ref<GLTFState> p_state, const GLTFSke
}
Error GLTFDocument::_parse_scenes(Ref<GLTFState> p_state) {
+ p_state->unique_names.insert("Skeleton3D"); // Reserve skeleton name.
ERR_FAIL_COND_V(!p_state->json.has("scenes"), ERR_FILE_CORRUPT);
const Array &scenes = p_state->json["scenes"];
int loaded_scene = 0;
@@ -4491,7 +4492,7 @@ Error GLTFDocument::_create_skeletons(Ref<GLTFState> p_state) {
p_state->skeleton3d_to_gltf_skeleton[skeleton->get_instance_id()] = skel_i;
// Make a unique name, no gltf node represents this skeleton
- skeleton->set_name(_gen_unique_name(p_state, "Skeleton3D"));
+ skeleton->set_name("Skeleton3D");
List<GLTFNodeIndex> bones;
@@ -5624,7 +5625,7 @@ void GLTFDocument::_generate_scene_node(Ref<GLTFState> p_state, Node *scene_pare
bone_attachment->set_owner(scene_root);
// There is no gltf_node that represent this, so just directly create a unique name
- bone_attachment->set_name(_gen_unique_name(p_state, "BoneAttachment3D"));
+ bone_attachment->set_name(gltf_node->get_name());
// We change the scene_parent to our bone attachment now. We do not set current_node because we want to make the node
// and attach it to the bone_attachment
@@ -5716,7 +5717,7 @@ void GLTFDocument::_generate_skeleton_bone_node(Ref<GLTFState> p_state, Node *p_
bone_attachment->set_owner(p_scene_root);
// There is no gltf_node that represent this, so just directly create a unique name
- bone_attachment->set_name(_gen_unique_name(p_state, "BoneAttachment3D"));
+ bone_attachment->set_name(gltf_node->get_name());
// We change the scene_parent to our bone attachment now. We do not set current_node because we want to make the node
// and attach it to the bone_attachment