Skip to content

Commit

Permalink
Ignore locked nodes when click selecting in 3d editor
Browse files Browse the repository at this point in the history
When selecting 3d nodes with a single click, the node closest to the
camera is selected. If the closest node was locked, it would block the
selection, even when there was unlocked nodes behind the locked node.

This PR replaces the `_select_ray` method call used to find the closest
node with the similar `_find_items_at_pos` method, which can skip any
locked nodes.

Fixes #84764
  • Loading branch information
EelisOtsamo authored and akien-mga committed Aug 19, 2024
1 parent a07f20b commit bf9fdc5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1918,12 +1918,17 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
}

if (after != EditorPlugin::AFTER_GUI_INPUT_CUSTOM) {
//clicking is always deferred to either move or release
clicked = _select_ray(b->get_position());
// Single item selection.
Vector<_RayResult> selection;
_find_items_at_pos(b->get_position(), selection, false);
if (!selection.is_empty()) {
clicked = selection[0].item->get_instance_id();
}

selection_in_progress = true;

if (clicked.is_null()) {
//default to regionselect
// Default to region select.
cursor.region_select = true;
cursor.region_begin = b->get_position();
cursor.region_end = b->get_position();
Expand Down

0 comments on commit bf9fdc5

Please sign in to comment.