Script editor: Don't open dominant script in external editor
Fixes #13429.
This commit is contained in:
parent
d7e00a20a6
commit
b5f110c77e
|
@ -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");
|
||||
// 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 (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (open_dominant && p_script.is_valid()) {
|
||||
if (open_dominant && !use_external_editor && p_script.is_valid()) {
|
||||
edit(p_script);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue