Ability to reload scripts on running game
This commit is contained in:
parent
45752eaae4
commit
9e745b920f
12 changed files with 247 additions and 18 deletions
|
|
@ -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;i<ScriptServer::get_language_count();i++) {
|
||||
ScriptServer::get_language(i)->reload_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;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class ScriptDebuggerRemote : public ScriptDebugger {
|
|||
bool profiling;
|
||||
int max_frame_functions;
|
||||
bool skip_profile_frame;
|
||||
bool reload_all_scripts;
|
||||
|
||||
|
||||
Ref<StreamPeerTCP> 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();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Script> get_script() const=0;
|
||||
|
||||
virtual bool is_placeholder() const { return false; }
|
||||
|
||||
virtual ScriptLanguage *get_language()=0;
|
||||
virtual ~ScriptInstance();
|
||||
};
|
||||
|
|
@ -189,6 +191,7 @@ public:
|
|||
|
||||
virtual Vector<StackInfo> debug_get_current_stack_info() { return Vector<StackInfo>(); }
|
||||
|
||||
virtual void reload_all_scripts()=0;
|
||||
/* LOADER FUNCTIONS */
|
||||
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const=0;
|
||||
|
|
@ -248,6 +251,8 @@ public:
|
|||
|
||||
void update(const List<PropertyInfo> &p_properties,const Map<StringName,Variant>& p_values); //likely changed in editor
|
||||
|
||||
virtual bool is_placeholder() const { return true; }
|
||||
|
||||
PlaceHolderScriptInstance(ScriptLanguage *p_language, Ref<Script> p_script,Object *p_owner);
|
||||
~PlaceHolderScriptInstance();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue