浏览代码

Merge pull request #83104 from jsjtxietian/fix-crash-when-reimport-animation-while-playing

Fix editor crash when re-importing GLTF while animation is playing
Rémi Verschelde 1 年之前
父节点
当前提交
6d47eff457
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      editor/editor_node.cpp

+ 6 - 0
editor/editor_node.cpp

@@ -1023,6 +1023,12 @@ void EditorNode::_resources_reimported(const Vector<String> &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);