MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _restart_editor

Method _restart_editor

editor/editor_node.cpp:6154–6194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6152}
6153
6154void EditorNode::_restart_editor(bool p_goto_project_manager) {
6155 exiting = true;
6156
6157 if (project_run_bar->is_playing()) {
6158 project_run_bar->stop_playing();
6159 }
6160
6161 String to_reopen;
6162 if (!p_goto_project_manager && get_tree()->get_edited_scene_root()) {
6163 to_reopen = get_tree()->get_edited_scene_root()->get_scene_file_path();
6164 }
6165
6166 _exit_editor(EXIT_SUCCESS);
6167
6168 List<String> args;
6169 for (const String &a : Main::get_forwardable_cli_arguments(Main::CLI_SCOPE_TOOL)) {
6170 args.push_back(a);
6171 }
6172
6173 if (p_goto_project_manager) {
6174 args.push_back("--project-manager");
6175
6176 // Setup working directory.
6177 const String exec_dir = OS::get_singleton()->get_executable_path().get_base_dir();
6178 if (!exec_dir.is_empty()) {
6179 args.push_back("--path");
6180 args.push_back(exec_dir);
6181 }
6182 } else {
6183 args.push_back("--path");
6184 args.push_back(ProjectSettings::get_singleton()->get_resource_path());
6185
6186 args.push_back("-e");
6187 }
6188
6189 if (!to_reopen.is_empty()) {
6190 args.push_back(to_reopen);
6191 }
6192
6193 OS::get_singleton()->set_restart_on_exit(true, args);
6194}
6195
6196void EditorNode::_scene_tab_closed(int p_tab) {
6197 current_menu_option = SCENE_TAB_CLOSE;

Callers

nothing calls this directly

Calls 10

stop_playingMethod · 0.80
get_scene_file_pathMethod · 0.80
get_base_dirMethod · 0.80
get_resource_pathMethod · 0.80
is_playingMethod · 0.45
get_edited_scene_rootMethod · 0.45
push_backMethod · 0.45
get_executable_pathMethod · 0.45
is_emptyMethod · 0.45
set_restart_on_exitMethod · 0.45

Tested by

no test coverage detected