Reimport bone attachment fixes:

Assign bone_idx to GLTF importer to fix serialization.
Notifies Skeletons and BoneAttachments when reimporting.
Removes usage of NOTIFICATION_NODE_RECACHE_REQUESTED
This commit is contained in:
Saracen
2023-09-28 05:32:32 +01:00
parent b662d232a2
commit 4b671eec0e
5 changed files with 48 additions and 1 deletions

View File

@@ -5846,6 +5846,10 @@ void GLTFDocument::_generate_scene_node(Ref<GLTFState> p_state, const GLTFNodeIn
BoneAttachment3D *bone_attachment = _generate_bone_attachment(p_state, active_skeleton, p_node_index, gltf_node->parent);
p_scene_parent->add_child(bone_attachment, true);
// Find the correct bone_idx so we can properly serialize it.
bone_attachment->set_bone_idx(active_skeleton->find_bone(gltf_node->get_name()));
bone_attachment->set_owner(p_scene_root);
// There is no gltf_node that represent this, so just directly create a unique name
@@ -5949,6 +5953,10 @@ void GLTFDocument::_generate_skeleton_bone_node(Ref<GLTFState> p_state, const GL
BoneAttachment3D *bone_attachment = _generate_bone_attachment(p_state, active_skeleton, p_node_index, p_node_index);
p_scene_parent->add_child(bone_attachment, true);
// Find the correct bone_idx so we can properly serialize it.
bone_attachment->set_bone_idx(active_skeleton->find_bone(gltf_node->get_name()));
bone_attachment->set_owner(p_scene_root);
// There is no gltf_node that represent this, so just directly create a unique name