1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Merge pull request #51729 from yjh0502/ext-reload-master

Auto-reload scripts with external editor
This commit is contained in:
Rémi Verschelde
2021-08-17 19:42:44 +02:00
committed by GitHub
3 changed files with 6 additions and 0 deletions

View File

@@ -942,7 +942,10 @@ void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
} }
_update_script_names(); _update_script_names();
_trigger_live_script_reload();
}
void ScriptEditor::_trigger_live_script_reload() {
if (!pending_auto_reload && auto_reload_running_scripts) { if (!pending_auto_reload && auto_reload_running_scripts) {
call_deferred(SNAME("_live_auto_reload_running_scripts")); call_deferred(SNAME("_live_auto_reload_running_scripts"));
pending_auto_reload = true; pending_auto_reload = true;

View File

@@ -344,6 +344,7 @@ class ScriptEditor : public PanelContainer {
bool pending_auto_reload; bool pending_auto_reload;
bool auto_reload_running_scripts; bool auto_reload_running_scripts;
void _trigger_live_script_reload();
void _live_auto_reload_running_scripts(); void _live_auto_reload_running_scripts();
void _update_selected_editor_menu(); void _update_selected_editor_menu();

View File

@@ -666,6 +666,8 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
script->set_source_code(rel_script->get_source_code()); script->set_source_code(rel_script->get_source_code());
script->set_last_modified_time(rel_script->get_last_modified_time()); script->set_last_modified_time(rel_script->get_last_modified_time());
script->update_exports(); script->update_exports();
_trigger_live_script_reload();
} }
} }
} }