summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
authorAlfred R. Baudisch <alfred@alfredbaudisch.com>2022-07-23 14:29:30 +0200
committerAlfred R. Baudisch <alfred@alfredbaudisch.com>2022-07-25 17:37:03 +0200
commitc4433c37932aca14b45e76a0b3498561532a0055 (patch)
treebb38590e9644ae73b7d20d9a04d3381b4232175a /editor/editor_node.cpp
parentb50acebd48d7e45a1444e553a5ea9878ef87592a (diff)
When selecting Nodes in the Scene Tree, if the current EditorPlugin is "Script" and if text_editor/behavior/navigation/stay_in_script_editor_on_node_selected is true, force inspector_only in order to not switch the EditorPlugin to the Node's main plugin.
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ced63815b9..485b9ad203 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2176,6 +2176,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
Object *prev_inspected_object = InspectorDock::get_inspector_singleton()->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/behavior/navigation/stay_in_script_editor_on_node_selected"));
bool is_resource = current_obj->is_class("Resource");
bool is_node = current_obj->is_class("Node");
@@ -2214,6 +2215,9 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
NodeDock::get_singleton()->set_node(current_node);
SceneTreeDock::get_singleton()->set_selected(current_node);
InspectorDock::get_singleton()->update(current_node);
+ if (!inspector_only) {
+ inspector_only = stay_in_script_editor_on_node_selected && ScriptEditor::get_singleton()->is_visible_in_tree();
+ }
} else {
NodeDock::get_singleton()->set_node(nullptr);
SceneTreeDock::get_singleton()->set_selected(nullptr);