diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index bc396400120..c76b3504ae9 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2028,6 +2028,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) { Object *prev_inspected_object = get_inspector()->get_edited_object(); bool disable_folding = bool(EDITOR_GET("interface/inspector/disable_folding")); + bool stay_in_script_editor_on_node_selected = bool(EDITOR_GET("text_editor/navigation/stay_in_script_editor_on_node_selected")); bool is_resource = current_obj->is_class("Resource"); bool is_node = current_obj->is_class("Node"); @@ -2066,6 +2067,9 @@ void EditorNode::_edit_current(bool p_skip_foreign) { node_dock->set_node(current_node); scene_tree_dock->set_selected(current_node); inspector_dock->update(current_node); + if (!inspector_only) { + inspector_only = stay_in_script_editor_on_node_selected && ScriptEditor::get_singleton()->is_visible_in_tree(); + } } else { node_dock->set_node(nullptr); scene_tree_dock->set_selected(nullptr); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 29663426e6c..9ca528f7695 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -439,6 +439,7 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { hints["text_editor/navigation/minimap_width"] = PropertyInfo(Variant::INT, "text_editor/navigation/minimap_width", PROPERTY_HINT_RANGE, "50,250,1"); _initial_set("text_editor/navigation/mouse_extra_buttons_navigate_history", true); _initial_set("text_editor/navigation/drag_and_drop_selection", true); + _initial_set("text_editor/navigation/stay_in_script_editor_on_node_selected", true); // Appearance _initial_set("text_editor/appearance/show_line_numbers", true);