Script editor: Don't open dominant script in external editor
Fixes #13429. (cherry picked from commitsb5f110c77e
,6b3f013a82
, ande016859c3b
)
This commit is contained in:
parent
a2f034d3ab
commit
518f109927
@ -2057,15 +2057,15 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
|
|||||||
|
|
||||||
Ref<Script> script = p_resource;
|
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") ||
|
||||||
|
(script.is_valid() && script->get_language()->overrides_external_editor());
|
||||||
|
const bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
|
||||||
|
|
||||||
// see if already has it
|
const bool should_open = (open_dominant && !use_external_editor) || !EditorNode::get_singleton()->is_changing_scene();
|
||||||
|
|
||||||
bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
|
if (script.is_valid() && script->get_language()->overrides_external_editor()) {
|
||||||
|
|
||||||
const bool should_open = open_dominant || !EditorNode::get_singleton()->is_changing_scene();
|
|
||||||
|
|
||||||
if (script != NULL && script->get_language()->overrides_external_editor()) {
|
|
||||||
if (should_open) {
|
if (should_open) {
|
||||||
Error err = script->get_language()->open_in_external_editor(script, p_line >= 0 ? p_line : 0, p_col);
|
Error err = script->get_language()->open_in_external_editor(script, p_line >= 0 ? p_line : 0, p_col);
|
||||||
if (err != OK)
|
if (err != OK)
|
||||||
@ -2074,11 +2074,10 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((debugger->get_dump_stack_script() != p_resource || debugger->get_debug_with_external_editor()) &&
|
if (use_external_editor &&
|
||||||
|
(debugger->get_dump_stack_script() != p_resource || debugger->get_debug_with_external_editor()) &&
|
||||||
p_resource->get_path().is_resource_file() &&
|
p_resource->get_path().is_resource_file() &&
|
||||||
p_resource->get_class_name() != StringName("VisualScript") &&
|
p_resource->get_class_name() != StringName("VisualScript")) {
|
||||||
bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) {
|
|
||||||
|
|
||||||
String path = EditorSettings::get_singleton()->get("text_editor/external/exec_path");
|
String path = EditorSettings::get_singleton()->get("text_editor/external/exec_path");
|
||||||
String flags = EditorSettings::get_singleton()->get("text_editor/external/exec_flags");
|
String flags = EditorSettings::get_singleton()->get("text_editor/external/exec_flags");
|
||||||
|
|
||||||
@ -2972,13 +2971,13 @@ Vector<Ref<Script> > ScriptEditor::get_open_scripts() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::set_scene_root_script(Ref<Script> p_script) {
|
void ScriptEditor::set_scene_root_script(Ref<Script> p_script) {
|
||||||
|
// 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") ||
|
||||||
|
(p_script.is_valid() && p_script->get_language()->overrides_external_editor());
|
||||||
|
const bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
|
||||||
|
|
||||||
bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
|
if (open_dominant && !use_external_editor && p_script.is_valid()) {
|
||||||
|
|
||||||
if (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (open_dominant && p_script.is_valid()) {
|
|
||||||
edit(p_script);
|
edit(p_script);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user