mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 18:41:29 +00:00
Replace use of OS::set_exit_code() by SceneTree::quit() in EditorNode
This commit is contained in:
parent
366d3930ac
commit
2ec7c6a6bc
3 changed files with 12 additions and 8 deletions
|
|
@ -295,6 +295,9 @@ public:
|
||||||
virtual void debug_break();
|
virtual void debug_break();
|
||||||
|
|
||||||
virtual int get_exit_code() const;
|
virtual int get_exit_code() const;
|
||||||
|
// `set_exit_code` should only be used from `SceneTree` (or from a similar
|
||||||
|
// level, e.g. from the `Main::start` if leaving without creating a `SceneTree`).
|
||||||
|
// For other components, `SceneTree.quit()` should be used instead.
|
||||||
virtual void set_exit_code(int p_code);
|
virtual void set_exit_code(int p_code);
|
||||||
|
|
||||||
virtual int get_processor_count() const;
|
virtual int get_processor_count() const;
|
||||||
|
|
|
||||||
|
|
@ -957,9 +957,10 @@ void EditorNode::_fs_changed() {
|
||||||
|
|
||||||
if (!export_error.is_empty()) {
|
if (!export_error.is_empty()) {
|
||||||
ERR_PRINT(export_error);
|
ERR_PRINT(export_error);
|
||||||
OS::get_singleton()->set_exit_code(EXIT_FAILURE);
|
_exit_editor(EXIT_FAILURE);
|
||||||
|
} else {
|
||||||
|
_exit_editor(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
_exit_editor();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1775,7 +1776,7 @@ void EditorNode::restart_editor() {
|
||||||
to_reopen = get_tree()->get_edited_scene_root()->get_scene_file_path();
|
to_reopen = get_tree()->get_edited_scene_root()->get_scene_file_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
_exit_editor();
|
_exit_editor(EXIT_SUCCESS);
|
||||||
|
|
||||||
List<String> args;
|
List<String> args;
|
||||||
args.push_back("--path");
|
args.push_back("--path");
|
||||||
|
|
@ -2992,7 +2993,7 @@ int EditorNode::_next_unsaved_scene(bool p_valid_filename, int p_start) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::_exit_editor() {
|
void EditorNode::_exit_editor(int p_exit_code) {
|
||||||
exiting = true;
|
exiting = true;
|
||||||
resource_preview->stop(); // stop early to avoid crashes
|
resource_preview->stop(); // stop early to avoid crashes
|
||||||
_save_docks();
|
_save_docks();
|
||||||
|
|
@ -3000,7 +3001,7 @@ void EditorNode::_exit_editor() {
|
||||||
// Dim the editor window while it's quitting to make it clearer that it's busy
|
// Dim the editor window while it's quitting to make it clearer that it's busy
|
||||||
dim_editor(true);
|
dim_editor(true);
|
||||||
|
|
||||||
get_tree()->quit();
|
get_tree()->quit(p_exit_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::_discard_changes(const String &p_str) {
|
void EditorNode::_discard_changes(const String &p_str) {
|
||||||
|
|
@ -3050,12 +3051,12 @@ void EditorNode::_discard_changes(const String &p_str) {
|
||||||
} break;
|
} break;
|
||||||
case FILE_QUIT: {
|
case FILE_QUIT: {
|
||||||
_menu_option_confirm(RUN_STOP, true);
|
_menu_option_confirm(RUN_STOP, true);
|
||||||
_exit_editor();
|
_exit_editor(EXIT_SUCCESS);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case RUN_PROJECT_MANAGER: {
|
case RUN_PROJECT_MANAGER: {
|
||||||
_menu_option_confirm(RUN_STOP, true);
|
_menu_option_confirm(RUN_STOP, true);
|
||||||
_exit_editor();
|
_exit_editor(EXIT_SUCCESS);
|
||||||
String exec = OS::get_singleton()->get_executable_path();
|
String exec = OS::get_singleton()->get_executable_path();
|
||||||
|
|
||||||
List<String> args;
|
List<String> args;
|
||||||
|
|
|
||||||
|
|
@ -529,7 +529,7 @@ private:
|
||||||
void _add_dropped_files_recursive(const Vector<String> &p_files, String to_path);
|
void _add_dropped_files_recursive(const Vector<String> &p_files, String to_path);
|
||||||
String _recent_scene;
|
String _recent_scene;
|
||||||
|
|
||||||
void _exit_editor();
|
void _exit_editor(int p_exit_code);
|
||||||
|
|
||||||
bool convert_old;
|
bool convert_old;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue