Merge pull request #96308 from SaracenOne/attempt_to_reset_imported_scene

Attempt applying RESET pose during import.
This commit is contained in:
Rémi Verschelde 2024-08-30 09:59:59 +02:00
commit 7f86ca057a
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 13 additions and 0 deletions

View File

@ -3104,6 +3104,19 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
}
}
// Apply RESET animation before serializing.
if (_scene_import_type == "PackedScene") {
int scene_child_count = scene->get_child_count();
for (int i = 0; i < scene_child_count; i++) {
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(scene->get_child(i));
if (ap) {
if (ap->can_apply_reset()) {
ap->apply_reset();
}
}
}
}
if (post_import_script.is_valid()) {
post_import_script->init(p_source_file);
scene = post_import_script->post_import(scene);