Merge pull request #82956 from Chtau/GDScript-external-Editor-Engine-crash

Fixes internal Script Editor crash with External Editor active
This commit is contained in:
Rémi Verschelde 2023-11-10 10:43:58 +01:00
commit 38c3e5aae9
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 9 additions and 3 deletions

View file

@ -445,7 +445,7 @@ String ScriptEditor::_get_debug_tooltip(const String &p_text, Node *_se) {
}
void ScriptEditor::_breaked(bool p_breaked, bool p_can_debug) {
if (bool(EDITOR_GET("text_editor/external/use_external_editor"))) {
if (external_editor_active) {
return;
}
@ -2278,7 +2278,7 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col,
// Don't open dominant script if using an external editor.
bool use_external_editor =
EDITOR_GET("text_editor/external/use_external_editor") ||
external_editor_active ||
(scr.is_valid() && scr->get_language()->overrides_external_editor());
use_external_editor = use_external_editor && !(scr.is_valid() && scr->is_built_in()); // Ignore external editor for built-in scripts.
const bool open_dominant = EDITOR_GET("text_editor/behavior/files/open_dominant_script_on_scene_change");
@ -2608,6 +2608,9 @@ void ScriptEditor::apply_scripts() const {
}
void ScriptEditor::reload_scripts(bool p_refresh_only) {
if (external_editor_active) {
return;
}
for (int i = 0; i < tab_container->get_tab_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
@ -2775,6 +2778,7 @@ void ScriptEditor::_editor_settings_changed() {
members_overview_enabled = EDITOR_GET("text_editor/script_list/show_members_overview");
help_overview_enabled = EDITOR_GET("text_editor/help/show_help_index");
external_editor_active = EDITOR_GET("text_editor/external/use_external_editor");
_update_members_overview_visibility();
_update_help_overview_visibility();
@ -3571,7 +3575,7 @@ TypedArray<ScriptEditorBase> ScriptEditor::_get_open_script_editors() const {
void ScriptEditor::set_scene_root_script(Ref<Script> p_script) {
// Don't open dominant script if using an external editor.
bool use_external_editor =
EDITOR_GET("text_editor/external/use_external_editor") ||
external_editor_active ||
(p_script.is_valid() && p_script->get_language()->overrides_external_editor());
use_external_editor = use_external_editor && !(p_script.is_valid() && p_script->is_built_in()); // Ignore external editor for built-in scripts.
const bool open_dominant = EDITOR_GET("text_editor/behavior/files/open_dominant_script_on_scene_change");
@ -3839,6 +3843,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
waiting_update_names = false;
pending_auto_reload = false;
auto_reload_running_scripts = true;
external_editor_active = false;
members_overview_enabled = EDITOR_GET("text_editor/script_list/show_members_overview");
help_overview_enabled = EDITOR_GET("text_editor/help/show_help_index");

View file

@ -395,6 +395,7 @@ class ScriptEditor : public PanelContainer {
bool open_textfile_after_create = true;
bool trim_trailing_whitespace_on_save;
bool convert_indent_on_save;
bool external_editor_active;
void _goto_script_line2(int p_line);
void _goto_script_line(Ref<RefCounted> p_script, int p_line);