You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Make sure that scripts are reloaded if needed when they enter editing, fixes #4456
This commit is contained in:
@@ -531,7 +531,7 @@ static void _find_changed_scripts_for_external_editor(Node* p_base, Node*p_curre
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::_update_modified_scripts_for_external_editor() {
|
void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_for_script) {
|
||||||
|
|
||||||
if (!bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor")))
|
if (!bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor")))
|
||||||
return;
|
return;
|
||||||
@@ -547,6 +547,9 @@ void ScriptEditor::_update_modified_scripts_for_external_editor() {
|
|||||||
|
|
||||||
Ref<Script> script = E->get();
|
Ref<Script> script = E->get();
|
||||||
|
|
||||||
|
if (p_for_script.is_valid() && p_for_script!=script)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (script->get_path()=="" || script->get_path().find("local://")!=-1 || script->get_path().find("::")!=-1) {
|
if (script->get_path()=="" || script->get_path().find("local://")!=-1 || script->get_path().find("::")!=-1) {
|
||||||
|
|
||||||
continue; //internal script, who cares, though weird
|
continue; //internal script, who cares, though weird
|
||||||
@@ -900,7 +903,7 @@ void ScriptEditor::_live_auto_reload_running_scripts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ScriptEditor::_test_script_times_on_disk() {
|
bool ScriptEditor::_test_script_times_on_disk(Ref<Script> p_for_script) {
|
||||||
|
|
||||||
|
|
||||||
disk_changed_list->clear();
|
disk_changed_list->clear();
|
||||||
@@ -920,6 +923,9 @@ bool ScriptEditor::_test_script_times_on_disk() {
|
|||||||
|
|
||||||
Ref<Script> script = ste->get_edited_script();
|
Ref<Script> script = ste->get_edited_script();
|
||||||
|
|
||||||
|
if (p_for_script.is_valid() && p_for_script!=script)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (script->get_path()=="" || script->get_path().find("local://")!=-1 || script->get_path().find("::")!=-1)
|
if (script->get_path()=="" || script->get_path().find("local://")!=-1 || script->get_path().find("::")!=-1)
|
||||||
continue; //internal script, who cares
|
continue; //internal script, who cares
|
||||||
|
|
||||||
@@ -2128,6 +2134,12 @@ void ScriptEditor::edit(const Ref<Script>& p_script) {
|
|||||||
if (!restoring_layout) {
|
if (!restoring_layout) {
|
||||||
EditorNode::get_singleton()->save_layout();
|
EditorNode::get_singleton()->save_layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//test for modification, maybe the script was not edited but was loaded
|
||||||
|
|
||||||
|
_test_script_times_on_disk(p_script);
|
||||||
|
_update_modified_scripts_for_external_editor(p_script);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::save_all_scripts() {
|
void ScriptEditor::save_all_scripts() {
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ class ScriptEditor : public VBoxContainer {
|
|||||||
void _resave_scripts(const String& p_str);
|
void _resave_scripts(const String& p_str);
|
||||||
void _reload_scripts();
|
void _reload_scripts();
|
||||||
|
|
||||||
bool _test_script_times_on_disk();
|
bool _test_script_times_on_disk(Ref<Script> p_for_script=Ref<Script>());
|
||||||
|
|
||||||
void _close_current_tab();
|
void _close_current_tab();
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ class ScriptEditor : public VBoxContainer {
|
|||||||
void _go_to_tab(int p_idx);
|
void _go_to_tab(int p_idx);
|
||||||
void _update_history_pos(int p_new_pos);
|
void _update_history_pos(int p_new_pos);
|
||||||
void _update_script_colors();
|
void _update_script_colors();
|
||||||
void _update_modified_scripts_for_external_editor();
|
void _update_modified_scripts_for_external_editor(Ref<Script> p_for_script=Ref<Script>());
|
||||||
|
|
||||||
int file_dialog_option;
|
int file_dialog_option;
|
||||||
void _file_dialog_action(String p_file);
|
void _file_dialog_action(String p_file);
|
||||||
|
|||||||
Reference in New Issue
Block a user