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

Support multiple debug protocols.

This commit is contained in:
Fabio Alessandrelli
2020-03-16 09:37:43 +01:00
parent ed225faf31
commit d79e28c302
13 changed files with 78 additions and 41 deletions

View File

@@ -2072,9 +2072,11 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
args = ProjectSettings::get_singleton()->get("editor/main_run_args");
skip_breakpoints = EditorDebuggerNode::get_singleton()->is_skip_breakpoints();
EditorDebuggerNode::get_singleton()->start();
Error error = editor_run.run(run_filename, args, breakpoints, skip_breakpoints);
if (error != OK) {
EditorDebuggerNode::get_singleton()->stop();
show_accept(TTR("Could not start subprocess!"), TTR("OK"));
return;
}
@@ -2096,6 +2098,24 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
_playing_edited = p_current;
}
void EditorNode::_run_native(const Ref<EditorExportPreset> &p_preset) {
bool autosave = EDITOR_GET("run/auto_save/save_before_running");
if (autosave) {
_menu_option_confirm(FILE_SAVE_ALL_SCENES, false);
}
if (run_native->is_deploy_debug_remote_enabled()) {
_menu_option_confirm(RUN_STOP, true);
if (!call_build())
return; // build failed
EditorDebuggerNode::get_singleton()->start(p_preset->get_platform()->get_debug_protocol());
emit_signal("play_pressed");
editor_run.run_native_notify();
}
}
void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (!p_confirmed) //this may be a hack..
@@ -2464,6 +2484,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
}
}
EditorDebuggerNode::get_singleton()->stop();
emit_signal("stop_pressed");
} break;
@@ -2482,22 +2503,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
_run(true);
} break;
case RUN_PLAY_NATIVE: {
bool autosave = EDITOR_GET("run/auto_save/save_before_running");
if (autosave) {
_menu_option_confirm(FILE_SAVE_ALL_SCENES, false);
}
if (run_native->is_deploy_debug_remote_enabled()) {
_menu_option_confirm(RUN_STOP, true);
if (!call_build())
break; // build failed
emit_signal("play_pressed");
editor_run.run_native_notify();
}
} break;
case RUN_SCENE_SETTINGS: {
run_settings_dialog->popup_run_settings();
@@ -6346,7 +6351,7 @@ EditorNode::EditorNode() {
run_native = memnew(EditorRunNative);
play_hb->add_child(run_native);
run_native->connect("native_run", callable_mp(this, &EditorNode::_menu_option), varray(RUN_PLAY_NATIVE));
run_native->connect("native_run", callable_mp(this, &EditorNode::_run_native));
play_scene_button = memnew(ToolButton);
play_hb->add_child(play_scene_button);