Ver código fonte

Allow selecting editor debug host and port.

Possibly fixes various editor<->debugger connection related problems.

(cherry picked from commit 98eb58a93cb34f42e42e6ee4f9f74fc15d4e9d85)
Fabio Alessandrelli 8 anos atrás
pai
commit
7a4dc3be41
3 arquivos alterados com 5 adições e 11 exclusões
  1. 2 7
      editor/editor_run.cpp
  2. 0 2
      editor/editor_settings.cpp
  3. 3 2
      main/main.cpp

+ 2 - 7
editor/editor_run.cpp

@@ -40,6 +40,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
 	List<String> args;
 
 	String resource_path = Globals::get_singleton()->get_resource_path();
+	String remote_host = EditorSettings::get_singleton()->get("network/debug_host");
 
 	if (resource_path != "") {
 		args.push_back("-path");
@@ -48,13 +49,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
 
 	if (true) {
 		args.push_back("-rdebug");
-#ifdef WINDOWS_ENABLED
-		// Avoid failing DNS lookup on disconnected Windows machines.
-		const char *debug_host = "127.0.0.1:";
-#else
-		const char *debug_host = "localhost:";
-#endif
-		args.push_back(debug_host + String::num(GLOBAL_DEF("debug/debug_port", 6007)));
+		args.push_back(remote_host + ":" + String::num(GLOBAL_DEF("debug/debug_port", 6007)));
 	}
 
 	args.push_back("-epid");

+ 0 - 2
editor/editor_settings.cpp

@@ -417,8 +417,6 @@ void EditorSettings::setup_network() {
 	for (List<IP_Address>::Element *E = local_ip.front(); E; E = E->next()) {
 
 		String ip = E->get();
-		if (ip == "127.0.0.1")
-			continue;
 
 		if (lip == "")
 			lip = ip;

+ 3 - 2
main/main.cpp

@@ -564,8 +564,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
 		ScriptDebuggerRemote *sdr = memnew(ScriptDebuggerRemote);
 		uint16_t debug_port = GLOBAL_DEF("debug/remote_port", 6007);
 		if (debug_host.find(":") != -1) {
-			debug_port = debug_host.get_slicec(':', 1).to_int();
-			debug_host = debug_host.get_slicec(':', 0);
+			int sep_pos = debug_host.find_last(":");
+			debug_port = debug_host.substr(sep_pos + 1, debug_host.length()).to_int();
+			debug_host = debug_host.substr(0, sep_pos);
 		}
 		Error derr = sdr->connect_to_host(debug_host, debug_port);