1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Revert follow-ups to #102313 before reverting that PR

This reverts the following commits:

- cd6e5ba9f4
- d36a3e5c06
- f2c6d16290
- aae51963ef
This commit is contained in:
Rémi Verschelde
2025-06-20 23:03:22 +02:00
parent 48f361a6eb
commit 6af4ef019c
3 changed files with 28 additions and 35 deletions

View File

@@ -1998,7 +1998,7 @@ void EditorNode::_save_scene_silently() {
// when Save on Focus Loss kicks in.
Node *scene = editor_data.get_edited_scene_root();
if (scene && !scene->get_scene_file_path().is_empty() && DirAccess::exists(scene->get_scene_file_path().get_base_dir())) {
_save_scene(scene->get_scene_file_path(), -1, false);
_save_scene(scene->get_scene_file_path());
save_editor_layout_delayed();
}
}
@@ -2026,29 +2026,23 @@ static void _reset_animation_mixers(Node *p_node, List<Pair<AnimationMixer *, Re
}
}
void EditorNode::_save_scene(String p_file, int idx, bool show_progress) {
void EditorNode::_save_scene(String p_file, int idx) {
ERR_FAIL_COND_MSG(!saving_scene.is_empty() && saving_scene == p_file, "Scene saved while already being saved!");
Node *scene = editor_data.get_edited_scene_root(idx);
if (show_progress) {
save_scene_progress = memnew(EditorProgress("save", TTR("Saving Scene"), 3));
save_scene_progress->step(TTR("Analyzing"), 0);
}
save_scene_progress = memnew(EditorProgress("save", TTR("Saving Scene"), 3));
save_scene_progress->step(TTR("Analyzing"), 0);
if (!scene) {
show_accept(TTR("This operation can't be done without a tree root."), TTR("OK"));
if (show_progress) {
_close_save_scene_progress();
}
_close_save_scene_progress();
return;
}
if (!scene->get_scene_file_path().is_empty() && _validate_scene_recursive(scene->get_scene_file_path(), scene)) {
show_accept(TTR("This scene can't be saved because there is a cyclic instance inclusion.\nPlease resolve it and then attempt to save again."), TTR("OK"));
if (show_progress) {
_close_save_scene_progress();
}
_close_save_scene_progress();
return;
}
@@ -2060,9 +2054,7 @@ void EditorNode::_save_scene(String p_file, int idx, bool show_progress) {
_reset_animation_mixers(scene, &anim_backups);
_save_editor_states(p_file, idx);
if (show_progress) {
save_scene_progress->step(TTR("Packing Scene"), 1);
}
save_scene_progress->step(TTR("Packing Scene"), 1);
Ref<PackedScene> sdata;
@@ -2084,15 +2076,11 @@ void EditorNode::_save_scene(String p_file, int idx, bool show_progress) {
if (err != OK) {
show_accept(TTR("Couldn't save scene. Likely dependencies (instances or inheritance) couldn't be satisfied."), TTR("OK"));
if (show_progress) {
_close_save_scene_progress();
}
_close_save_scene_progress();
return;
}
if (show_progress) {
save_scene_progress->step(TTR("Saving scene"), 2);
}
save_scene_progress->step(TTR("Saving scene"), 2);
int flg = 0;
if (EDITOR_GET("filesystem/on_save/compress_binary_resources")) {
@@ -2106,9 +2094,7 @@ void EditorNode::_save_scene(String p_file, int idx, bool show_progress) {
emit_signal(SNAME("scene_saved"), p_file);
editor_data.notify_scene_saved(p_file);
if (show_progress) {
save_scene_progress->step(TTR("Saving external resources"), 3);
}
save_scene_progress->step(TTR("Saving external resources"), 3);
_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.
@@ -2134,9 +2120,7 @@ void EditorNode::_save_scene(String p_file, int idx, bool show_progress) {
scene->propagate_notification(NOTIFICATION_EDITOR_POST_SAVE);
_update_unsaved_cache();
if (show_progress) {
_close_save_scene_progress();
}
_close_save_scene_progress();
}
void EditorNode::save_all_scenes() {
@@ -2176,7 +2160,7 @@ void EditorNode::try_autosave() {
Node *scene = editor_data.get_edited_scene_root();
if (scene && !scene->get_scene_file_path().is_empty()) { // Only autosave if there is a scene and if it has a path.
_save_scene(scene->get_scene_file_path(), -1, false);
_save_scene(scene->get_scene_file_path());
}
}
_menu_option(SCENE_SAVE_ALL_SCENES);