diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index a17b52c1e..68362b000 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1953,6 +1953,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"); @@ -1991,6 +1992,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 5faef22cc..1fdada525 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -454,6 +454,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);