summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-03-16 09:37:43 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-05-12 15:09:13 +0200
commitd79e28c3021a4410f41a3bbff111d56b28f155ef (patch)
tree250f03d617692ff4b0e3aaece14fc59126cd3fd0 /editor/editor_node.cpp
parented225faf31c9b3aa47154260aa1a7826d728acc8 (diff)
Support multiple debug protocols.
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 1b1ce4ec37..abb639254a 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -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);