|
@@ -5567,7 +5567,7 @@ void GLTFDocument::_generate_scene_node(Ref<GLTFState> state, Node *scene_parent
|
|
|
// Bone Attachment - Parent Case
|
|
|
BoneAttachment3D *bone_attachment = _generate_bone_attachment(state, active_skeleton, node_index, gltf_node->parent);
|
|
|
|
|
|
- scene_parent->add_child(bone_attachment);
|
|
|
+ scene_parent->add_child(bone_attachment, true);
|
|
|
bone_attachment->set_owner(scene_root);
|
|
|
|
|
|
// There is no gltf_node that represent this, so just directly create a unique name
|
|
@@ -5590,7 +5590,7 @@ void GLTFDocument::_generate_scene_node(Ref<GLTFState> state, Node *scene_parent
|
|
|
current_node = _generate_spatial(state, scene_parent, node_index);
|
|
|
}
|
|
|
|
|
|
- scene_parent->add_child(current_node);
|
|
|
+ scene_parent->add_child(current_node, true);
|
|
|
if (current_node != scene_root) {
|
|
|
current_node->set_owner(scene_root);
|
|
|
}
|
|
@@ -5620,7 +5620,7 @@ void GLTFDocument::_generate_skeleton_bone_node(Ref<GLTFState> state, Node *scen
|
|
|
// Bone Attachment - Direct Parented Skeleton Case
|
|
|
BoneAttachment3D *bone_attachment = _generate_bone_attachment(state, active_skeleton, node_index, gltf_node->parent);
|
|
|
|
|
|
- scene_parent->add_child(bone_attachment);
|
|
|
+ scene_parent->add_child(bone_attachment, true);
|
|
|
bone_attachment->set_owner(scene_root);
|
|
|
|
|
|
// There is no gltf_node that represent this, so just directly create a unique name
|
|
@@ -5634,7 +5634,7 @@ void GLTFDocument::_generate_skeleton_bone_node(Ref<GLTFState> state, Node *scen
|
|
|
|
|
|
// Add it to the scene if it has not already been added
|
|
|
if (skeleton->get_parent() == nullptr) {
|
|
|
- scene_parent->add_child(skeleton);
|
|
|
+ scene_parent->add_child(skeleton, true);
|
|
|
skeleton->set_owner(scene_root);
|
|
|
}
|
|
|
}
|
|
@@ -5648,7 +5648,7 @@ void GLTFDocument::_generate_skeleton_bone_node(Ref<GLTFState> state, Node *scen
|
|
|
// Bone Attachment - Same Node Case
|
|
|
BoneAttachment3D *bone_attachment = _generate_bone_attachment(state, active_skeleton, node_index, node_index);
|
|
|
|
|
|
- scene_parent->add_child(bone_attachment);
|
|
|
+ scene_parent->add_child(bone_attachment, true);
|
|
|
bone_attachment->set_owner(scene_root);
|
|
|
|
|
|
// There is no gltf_node that represent this, so just directly create a unique name
|
|
@@ -5668,7 +5668,7 @@ void GLTFDocument::_generate_skeleton_bone_node(Ref<GLTFState> state, Node *scen
|
|
|
current_node = _generate_light(state, scene_parent, node_index);
|
|
|
}
|
|
|
|
|
|
- scene_parent->add_child(current_node);
|
|
|
+ scene_parent->add_child(current_node, true);
|
|
|
if (current_node != scene_root) {
|
|
|
current_node->set_owner(scene_root);
|
|
|
}
|
|
@@ -6182,7 +6182,7 @@ void GLTFDocument::_process_mesh_instances(Ref<GLTFState> state, Node *scene_roo
|
|
|
ERR_CONTINUE_MSG(skeleton == nullptr, vformat("Unable to find Skeleton for node %d skin %d", node_i, skin_i));
|
|
|
|
|
|
mi->get_parent()->remove_child(mi);
|
|
|
- skeleton->add_child(mi);
|
|
|
+ skeleton->add_child(mi, true);
|
|
|
mi->set_owner(skeleton->get_owner());
|
|
|
|
|
|
mi->set_skin(state->skins.write[skin_i]->godot_skin);
|
|
@@ -6859,7 +6859,7 @@ Node *GLTFDocument::import_scene_gltf(const String &p_path, uint32_t p_flags, in
|
|
|
gltf_document->_process_mesh_instances(r_state, root);
|
|
|
if (r_state->animations.size()) {
|
|
|
AnimationPlayer *ap = memnew(AnimationPlayer);
|
|
|
- root->add_child(ap);
|
|
|
+ root->add_child(ap, true);
|
|
|
ap->set_owner(root);
|
|
|
for (int i = 0; i < r_state->animations.size(); i++) {
|
|
|
gltf_document->_import_animation(r_state, ap, i, p_bake_fps);
|