diff options
author | PrecisionRender <austin08dean@gmail.com> | 2023-01-21 20:27:04 -0600 |
---|---|---|
committer | PrecisionRender <austin08dean@gmail.com> | 2023-01-22 16:24:52 -0600 |
commit | 38fb8259d0a3773f56224b393b794f004910f3ee (patch) | |
tree | a174cd4023bb118292f73083128554265bca97b1 /editor | |
parent | eaf306e0b15e4283883f06bf903b05711a4dbfe8 (diff) |
Use selected node type for choosing editor tab
Use selected node type for choosing editor tab
Update editor/editor_node.cpp
Co-authored-by: Tomek <kobewi4e@gmail.com>
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_node.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 05e0c6750e..19d991b112 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3653,12 +3653,12 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) { if (get_edited_scene()) { if (current_tab < 2) { - // Use heuristic instead. - int n2d = 0, n3d = 0; - _find_node_types(get_edited_scene(), n2d, n3d); - if (n2d > n3d) { + Node *editor_node = SceneTreeDock::get_singleton()->get_tree_editor()->get_selected(); + editor_node = editor_node == nullptr ? get_edited_scene() : editor_node; + + if (Object::cast_to<Node2D>(editor_node) || Object::cast_to<Control>(editor_node)) { editor_select(EDITOR_2D); - } else if (n3d > n2d) { + } else if (Object::cast_to<Node3D>(editor_node)) { editor_select(EDITOR_3D); } } |