Skip to content

Commit 2124995

Browse files
authored
Merge pull request #96765 from adamscott/selecting-locked
Fix issue where editable children of 3D nodes would be selected
2 parents 27552a2 + 9d735b0 commit 2124995

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

editor/plugins/node_3d_editor_plugin.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos) const {
810810
Vector<Node3D *> nodes_with_gizmos = Node3DEditor::get_singleton()->gizmo_bvh_ray_query(pos, pos + ray * camera->get_far());
811811

812812
for (Node3D *spat : nodes_with_gizmos) {
813-
if (!spat) {
813+
if (!spat || _is_node_locked(spat)) {
814814
continue;
815815
}
816816

@@ -1557,7 +1557,7 @@ void Node3DEditorViewport::_surface_focus_exit() {
15571557
view_menu->set_disable_shortcuts(true);
15581558
}
15591559

1560-
bool Node3DEditorViewport ::_is_node_locked(const Node *p_node) {
1560+
bool Node3DEditorViewport::_is_node_locked(const Node *p_node) const {
15611561
return p_node->get_meta("_edit_lock_", false);
15621562
}
15631563

@@ -1935,11 +1935,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
19351935

19361936
if (after != EditorPlugin::AFTER_GUI_INPUT_CUSTOM) {
19371937
// Single item selection.
1938-
Vector<_RayResult> selection;
1939-
_find_items_at_pos(b->get_position(), selection, false);
1940-
if (!selection.is_empty()) {
1941-
clicked = selection[0].item->get_instance_id();
1942-
}
1938+
clicked = _select_ray(b->get_position());
19431939

19441940
selection_in_progress = true;
19451941

editor/plugins/node_3d_editor_plugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ class Node3DEditorViewport : public Control {
460460

461461
bool previewing_camera = false;
462462
bool previewing_cinema = false;
463-
bool _is_node_locked(const Node *p_node);
463+
bool _is_node_locked(const Node *p_node) const;
464464
void _preview_exited_scene();
465465
void _toggle_camera_preview(bool);
466466
void _toggle_cinema_preview(bool);

0 commit comments

Comments
 (0)