Skip to content

Commit

Permalink
Merge pull request #83104 from jsjtxietian/fix-crash-when-reimport-an…
Browse files Browse the repository at this point in the history
…imation-while-playing

Fix editor crash when re-importing GLTF while animation is playing
  • Loading branch information
akien-mga committed Nov 15, 2023
2 parents d5217b6 + 3c10493 commit 6d47eff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6d47eff

Please sign in to comment.