diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-07-26 23:55:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-26 23:55:43 +0200 |
commit | 0a7942f4bb61cba8f02f2cbe0ec83b95eefa6726 (patch) | |
tree | bc6bb470d30107bc18e01f482a435270dab0992c /editor | |
parent | 8636be35b2b209bf6296f602e461273b855b7e18 (diff) | |
parent | b5f110c77eaef5d9f1b3b0c9308a4eed65f04363 (diff) |
Merge pull request #40735 from akien-mga/no-dominion-outside-borders
Script editor: Don't open dominant script in external editor
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 756444097d..713d57ee95 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2091,13 +2091,11 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra Ref<Script> script = p_resource; - // refuse to open built-in if scene is not loaded + // Don't open dominant script if using an external editor. + const bool use_external_editor = EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"); + const bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change"); - // see if already has it - - bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change"); - - const bool should_open = open_dominant || !EditorNode::get_singleton()->is_changing_scene(); + const bool should_open = (open_dominant && !use_external_editor) || !EditorNode::get_singleton()->is_changing_scene(); if (script != nullptr && script->get_language()->overrides_external_editor()) { if (should_open) { @@ -2109,10 +2107,10 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra return false; } - if ((EditorDebuggerNode::get_singleton()->get_dump_stack_script() != p_resource || EditorDebuggerNode::get_singleton()->get_debug_with_external_editor()) && + if (use_external_editor && + (EditorDebuggerNode::get_singleton()->get_dump_stack_script() != p_resource || EditorDebuggerNode::get_singleton()->get_debug_with_external_editor()) && p_resource->get_path().is_resource_file() && - p_resource->get_class_name() != StringName("VisualScript") && - bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) { + p_resource->get_class_name() != StringName("VisualScript")) { String path = EditorSettings::get_singleton()->get("text_editor/external/exec_path"); String flags = EditorSettings::get_singleton()->get("text_editor/external/exec_flags"); @@ -3002,13 +3000,11 @@ Array ScriptEditor::_get_open_script_editors() const { } void ScriptEditor::set_scene_root_script(Ref<Script> p_script) { - bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change"); - - if (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) { - return; - } + // Don't open dominant script if using an external editor. + const bool use_external_editor = EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"); + const bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change"); - if (open_dominant && p_script.is_valid()) { + if (open_dominant && !use_external_editor && p_script.is_valid()) { edit(p_script); } } |