diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 011b1f78a07..99d1e22c07a 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -291,6 +291,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { _set_object_property(cmd[1],cmd[2],cmd[3]); + } else if (command=="reload_scripts") { + reload_all_scripts=true; } else if (command=="breakpoint") { bool set = cmd[3]; @@ -698,7 +700,8 @@ void ScriptDebuggerRemote::_poll_events() { profiling=false; _send_profiling_data(false); print_line("PROFILING END!"); - + } else if (command=="reload_scripts") { + reload_all_scripts=true; } else if (command=="breakpoint") { bool set = cmd[3]; @@ -863,6 +866,14 @@ void ScriptDebuggerRemote::idle_poll() { } } + if (reload_all_scripts) { + + for(int i=0;ireload_all_scripts(); + } + reload_all_scripts=false; + } + _poll_events(); } @@ -1012,6 +1023,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() { profile_info_ptrs.resize(profile_info.size()); profiling=false; max_frame_functions=16; + reload_all_scripts=false; } diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h index 8fdab470136..c6a00e189f4 100644 --- a/core/script_debugger_remote.h +++ b/core/script_debugger_remote.h @@ -60,6 +60,7 @@ class ScriptDebuggerRemote : public ScriptDebugger { bool profiling; int max_frame_functions; bool skip_profile_frame; + bool reload_all_scripts; Ref tcp_client; @@ -168,6 +169,7 @@ public: virtual void profiling_end(); virtual void profiling_set_frame_times(float p_frame_time,float p_idle_time,float p_fixed_time,float p_fixed_frame_time); + ScriptDebuggerRemote(); ~ScriptDebuggerRemote(); }; diff --git a/core/script_language.cpp b/core/script_language.cpp index 15034182697..b3116a0297e 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -51,7 +51,7 @@ void Script::_bind_methods() { ObjectTypeDB::bind_method(_MD("has_source_code"),&Script::has_source_code); ObjectTypeDB::bind_method(_MD("get_source_code"),&Script::get_source_code); ObjectTypeDB::bind_method(_MD("set_source_code","source"),&Script::set_source_code); - ObjectTypeDB::bind_method(_MD("reload"),&Script::reload); + ObjectTypeDB::bind_method(_MD("reload","keep_state"),&Script::reload,DEFVAL(false)); } diff --git a/core/script_language.h b/core/script_language.h index bd76107acfb..d8b4c61b6cd 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -87,7 +87,7 @@ public: virtual bool has_source_code() const=0; virtual String get_source_code() const=0; virtual void set_source_code(const String& p_code)=0; - virtual Error reload()=0; + virtual Error reload(bool p_keep_state=false)=0; virtual bool is_tool() const=0; @@ -127,6 +127,8 @@ public: virtual Ref