From 3c10493d0bd1982bb6f6addf4fa3aebd9fd883bd Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Wed, 11 Oct 2023 12:58:08 +0800 Subject: [PATCH] Fix Editor crash when re-importing GLTF while animation is playing --- editor/editor_node.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index ad324c3ae62..9453592329c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1023,6 +1023,12 @@ void EditorNode::_resources_reimported(const Vector &p_resources) { } } + // Editor may crash when related animation is playing while re-importing GLTF scene, stop it in advance. + AnimationPlayer *ap = AnimationPlayerEditor::get_singleton()->get_player(); + if (ap && scenes.size() > 0) { + ap->stop(true); + } + for (const String &E : scenes) { reload_scene(E); reload_instances_with_path_in_edited_scenes(E);