summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-09-21 10:24:40 +0200
committerGitHub <noreply@github.com>2017-09-21 10:24:40 +0200
commit5c76e638ab52b695ea6ec9fbdc5d1b66c5298995 (patch)
tree5a04c62fdbed298d7f5e05f2fe4aa3cff31cc885 /editor/plugins
parent0eec37e24781ff16979ed5ab6c8706a11584c3f5 (diff)
parent3cecd0c6dcb98586177186ef1ce7179fe6f97ca5 (diff)
Merge pull request #11187 from SaracenOne/subscene_box_selection
Box selection for MeshInstances and subscene nodes.
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 6b485aab7c..07797be47d 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -465,7 +465,6 @@ void SpatialEditorViewport::_select_region() {
Vector<Plane> frustum;
Vector3 cam_pos = _get_camera_position();
- Set<Ref<SpatialEditorGizmo> > found_gizmos;
for (int i = 0; i < 4; i++) {
@@ -485,6 +484,9 @@ void SpatialEditorViewport::_select_region() {
frustum.push_back(far);
Vector<ObjectID> instances = VisualServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world()->get_scenario());
+ Vector<Spatial *> selected;
+
+ Node *edited_scene = get_tree()->get_edited_scene_root();
for (int i = 0; i < instances.size(); i++) {
@@ -497,11 +499,14 @@ void SpatialEditorViewport::_select_region() {
if (!seg.is_valid())
continue;
- if (found_gizmos.has(seg))
- continue;
+ Spatial *root_sp = sp;
+ while (root_sp && root_sp != edited_scene && root_sp->get_owner() != edited_scene && !edited_scene->is_editable_instance(root_sp->get_owner())) {
+ root_sp = Object::cast_to<Spatial>(root_sp->get_owner());
+ }
- if (seg->intersect_frustum(camera, frustum))
- _select(sp, true, false);
+ if (selected.find(root_sp) == -1)
+ if (seg->intersect_frustum(camera, frustum))
+ _select(root_sp, true, false);
}
}