Fix script overwriting with external editor

(cherry picked from commit 23927c3d9b)
This commit is contained in:
kit 2024-08-23 16:34:24 -04:00 committed by Rémi Verschelde
parent 4d7feff723
commit 4fabc1ba58
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 6 additions and 3 deletions

View File

@ -2711,9 +2711,11 @@ void ScriptEditor::apply_scripts() const {
} }
void ScriptEditor::reload_scripts(bool p_refresh_only) { void ScriptEditor::reload_scripts(bool p_refresh_only) {
if (external_editor_active) { // Call deferred to make sure it runs on the main thread.
return; callable_mp(this, &ScriptEditor::_reload_scripts).call_deferred(p_refresh_only);
} }
void ScriptEditor::_reload_scripts(bool p_refresh_only) {
for (int i = 0; i < tab_container->get_tab_count(); i++) { for (int i = 0; i < tab_container->get_tab_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i)); ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) { if (!se) {

View File

@ -436,6 +436,7 @@ class ScriptEditor : public PanelContainer {
void _file_removed(const String &p_file); void _file_removed(const String &p_file);
void _autosave_scripts(); void _autosave_scripts();
void _update_autosave_timer(); void _update_autosave_timer();
void _reload_scripts(bool p_refresh_only = false);
void _update_members_overview_visibility(); void _update_members_overview_visibility();
void _update_members_overview(); void _update_members_overview();