You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #109637 from van800/shakhov/dap
Extend DAP to allow debug main/current/specific_scene/secondary_editor and also commanline arguments
This commit is contained in:
@@ -184,6 +184,20 @@ Dictionary DebugAdapterParser::req_launch(const Dictionary &p_params) const {
|
|||||||
return Dictionary();
|
return Dictionary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector<String> DebugAdapterParser::_extract_play_arguments(const Dictionary &p_args) const {
|
||||||
|
Vector<String> play_args;
|
||||||
|
if (p_args.has("playArgs")) {
|
||||||
|
Variant v = p_args["playArgs"];
|
||||||
|
if (v.get_type() == Variant::ARRAY) {
|
||||||
|
Array arr = v;
|
||||||
|
for (const Variant &arg : arr) {
|
||||||
|
play_args.push_back(String(arg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return play_args;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary DebugAdapterParser::_launch_process(const Dictionary &p_params) const {
|
Dictionary DebugAdapterParser::_launch_process(const Dictionary &p_params) const {
|
||||||
Dictionary args = p_params["arguments"];
|
Dictionary args = p_params["arguments"];
|
||||||
ScriptEditorDebugger *dbg = EditorDebuggerNode::get_singleton()->get_default_debugger();
|
ScriptEditorDebugger *dbg = EditorDebuggerNode::get_singleton()->get_default_debugger();
|
||||||
@@ -193,7 +207,15 @@ Dictionary DebugAdapterParser::_launch_process(const Dictionary &p_params) const
|
|||||||
|
|
||||||
String platform_string = args.get("platform", "host");
|
String platform_string = args.get("platform", "host");
|
||||||
if (platform_string == "host") {
|
if (platform_string == "host") {
|
||||||
EditorRunBar::get_singleton()->play_main_scene();
|
Vector<String> play_args = _extract_play_arguments(args);
|
||||||
|
const String scene = args.get("scene", "main");
|
||||||
|
if (scene == "main") {
|
||||||
|
EditorRunBar::get_singleton()->play_main_scene(false, play_args);
|
||||||
|
} else if (scene == "current") {
|
||||||
|
EditorRunBar::get_singleton()->play_current_scene(false, play_args);
|
||||||
|
} else {
|
||||||
|
EditorRunBar::get_singleton()->play_custom_scene(scene, play_args);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
int device = args.get("device", -1);
|
int device = args.get("device", -1);
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ public:
|
|||||||
Dictionary req_godot_put_msg(const Dictionary &p_params) const;
|
Dictionary req_godot_put_msg(const Dictionary &p_params) const;
|
||||||
|
|
||||||
// Internal requests
|
// Internal requests
|
||||||
|
Vector<String> _extract_play_arguments(const Dictionary &p_args) const;
|
||||||
Dictionary _launch_process(const Dictionary &p_params) const;
|
Dictionary _launch_process(const Dictionary &p_params) const;
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ void EditorRunBar::recovery_mode_reload_project() {
|
|||||||
EditorNode::get_singleton()->trigger_menu_option(EditorNode::PROJECT_RELOAD_CURRENT_PROJECT, false);
|
EditorNode::get_singleton()->trigger_menu_option(EditorNode::PROJECT_RELOAD_CURRENT_PROJECT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorRunBar::play_main_scene(bool p_from_native) {
|
void EditorRunBar::play_main_scene(bool p_from_native, const Vector<String> &p_play_args) {
|
||||||
if (Engine::get_singleton()->is_recovery_mode_hint()) {
|
if (Engine::get_singleton()->is_recovery_mode_hint()) {
|
||||||
EditorToaster::get_singleton()->popup_str(TTR("Recovery Mode is enabled. Disable it to run the project."), EditorToaster::SEVERITY_WARNING);
|
EditorToaster::get_singleton()->popup_str(TTR("Recovery Mode is enabled. Disable it to run the project."), EditorToaster::SEVERITY_WARNING);
|
||||||
return;
|
return;
|
||||||
@@ -387,7 +387,7 @@ void EditorRunBar::play_main_scene(bool p_from_native) {
|
|||||||
stop_playing();
|
stop_playing();
|
||||||
|
|
||||||
current_mode = RunMode::RUN_MAIN;
|
current_mode = RunMode::RUN_MAIN;
|
||||||
_run_scene();
|
_run_scene("", p_play_args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,7 +582,7 @@ EditorRunBar::EditorRunBar() {
|
|||||||
play_button->set_toggle_mode(true);
|
play_button->set_toggle_mode(true);
|
||||||
play_button->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
|
play_button->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
|
||||||
play_button->set_tooltip_text(TTRC("Run the project's default scene."));
|
play_button->set_tooltip_text(TTRC("Run the project's default scene."));
|
||||||
play_button->connect(SceneStringName(pressed), callable_mp(this, &EditorRunBar::play_main_scene).bind(false));
|
play_button->connect(SceneStringName(pressed), callable_mp(this, &EditorRunBar::play_main_scene).bind(false, Vector<String>()));
|
||||||
|
|
||||||
ED_SHORTCUT_AND_COMMAND("editor/run_project", TTRC("Run Project"), Key::F5);
|
ED_SHORTCUT_AND_COMMAND("editor/run_project", TTRC("Run Project"), Key::F5);
|
||||||
ED_SHORTCUT_OVERRIDE("editor/run_project", "macos", KeyModifierMask::META | Key::B);
|
ED_SHORTCUT_OVERRIDE("editor/run_project", "macos", KeyModifierMask::META | Key::B);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public:
|
|||||||
void recovery_mode_show_dialog();
|
void recovery_mode_show_dialog();
|
||||||
void recovery_mode_reload_project();
|
void recovery_mode_reload_project();
|
||||||
|
|
||||||
void play_main_scene(bool p_from_native = false);
|
void play_main_scene(bool p_from_native = false, const Vector<String> &p_play_args = Vector<String>());
|
||||||
void play_current_scene(bool p_reload = false, const Vector<String> &p_play_args = Vector<String>());
|
void play_current_scene(bool p_reload = false, const Vector<String> &p_play_args = Vector<String>());
|
||||||
void play_custom_scene(const String &p_custom, const Vector<String> &p_play_args = Vector<String>());
|
void play_custom_scene(const String &p_custom, const Vector<String> &p_play_args = Vector<String>());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user