Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid saving scene while already saving the scene #85154

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,10 @@ static void _reset_animation_mixers(Node *p_node, List<Pair<AnimationMixer *, Re
}

void EditorNode::_save_scene(String p_file, int idx) {
if (!saving_scene.is_empty() && saving_scene == p_file) {
return;
}

Node *scene = editor_data.get_edited_scene_root(idx);

if (!scene) {
Expand Down Expand Up @@ -1817,7 +1821,9 @@ void EditorNode::_save_scene(String p_file, int idx) {
emit_signal(SNAME("scene_saved"), p_file);

_save_external_resources();
saving_scene = p_file; // Some editors may save scenes of built-in resources as external data, so avoid saving this scene again.
editor_data.save_editor_external_data();
saving_scene = "";

for (Pair<AnimationMixer *, Ref<AnimatedValuesBackup>> &E : anim_backups) {
E.first->restore(E.second);
Expand Down
1 change: 1 addition & 0 deletions editor/editor_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ class EditorNode : public Node {
String _tmp_import_path;
String external_file;
String open_navigate;
String saving_scene;

DynamicFontImportSettings *fontdata_import_settings = nullptr;
SceneImportSettings *scene_import_settings = nullptr;
Expand Down
Loading