Skip to content

Commit

Permalink
[Editor] Allow selecting instanced scenes with select list
Browse files Browse the repository at this point in the history
Picks the owning instance as is done in other selection methods
  • Loading branch information
AThousandShips committed Jan 19, 2025
1 parent 9630d4e commit 5068cca
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -885,16 +885,27 @@ void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, Vector<_RayRe

HashSet<Node3D *> found_nodes;

Node *edited_scene = get_tree()->get_edited_scene_root();

for (Node3D *spat : nodes_with_gizmos) {
if (!spat) {
continue;
}

if (found_nodes.has(spat)) {
Node3D *item = spat;
if (item != edited_scene) {
item = Object::cast_to<Node3D>(edited_scene->get_deepest_editable_node(item));
}

if (!item) {
continue;
}

if (found_nodes.has(item)) {
continue;
}

if (!p_include_locked_nodes && _is_node_locked(spat)) {
if (!p_include_locked_nodes && _is_node_locked(item)) {
continue;
}

Expand All @@ -921,10 +932,10 @@ void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, Vector<_RayRe
continue;
}

found_nodes.insert(spat);
found_nodes.insert(item);

_RayResult res;
res.item = spat;
res.item = item;
res.depth = dist;
r_results.push_back(res);
break;
Expand Down Expand Up @@ -1630,10 +1641,9 @@ void Node3DEditorViewport::_list_select(Ref<InputEventMouseButton> b) {
if (_is_node_locked(spat)) {
locked = 1;
} else {
Node *ed_scene = EditorNode::get_singleton()->get_edited_scene();
Node *node = spat;

while (node && node != ed_scene->get_parent()) {
while (node && node != edited_scene->get_parent()) {
Node3D *selected_tmp = Object::cast_to<Node3D>(node);
if (selected_tmp && node->has_meta("_edit_group_")) {
locked = 2;
Expand Down

0 comments on commit 5068cca

Please sign in to comment.