Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
63453471
Commit
63453471
authored
Aug 16, 2017
by
Rémi Verschelde
Committed by
GitHub
Aug 16, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10326 from kubecz3k/spatial-click-improve
spatial selection if subscene geometry is far from origin
parents
c1a43a09
78e72c8e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
spatial_editor_plugin.cpp
editor/plugins/spatial_editor_plugin.cpp
+6
-2
No files found.
editor/plugins/spatial_editor_plugin.cpp
View file @
63453471
...
...
@@ -267,6 +267,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
int
selected_handle
=
-
1
;
Vector
<
Spatial
*>
subscenes
=
Vector
<
Spatial
*>
();
Vector
<
Vector3
>
subscenes_positions
=
Vector
<
Vector3
>
();
for
(
int
i
=
0
;
i
<
instances
.
size
();
i
++
)
{
...
...
@@ -284,13 +285,16 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
if
((
!
seg
.
is_valid
())
||
found_gizmos
.
has
(
seg
))
{
Node
*
subscene_candidate
=
spat
;
Vector3
source_click_spatial_pos
=
spat
->
get_global_transform
().
origin
;
while
((
subscene_candidate
->
get_owner
()
!=
NULL
)
&&
(
subscene_candidate
->
get_owner
()
!=
editor
->
get_edited_scene
()))
subscene_candidate
=
subscene_candidate
->
get_owner
();
spat
=
subscene_candidate
->
cast_to
<
Spatial
>
();
if
(
spat
&&
(
spat
->
get_filename
()
!=
""
)
&&
(
subscene_candidate
->
get_owner
()
!=
NULL
))
if
(
spat
&&
(
spat
->
get_filename
()
!=
""
)
&&
(
subscene_candidate
->
get_owner
()
!=
NULL
))
{
subscenes
.
push_back
(
spat
);
subscenes_positions
.
push_back
(
source_click_spatial_pos
);
}
continue
;
}
...
...
@@ -324,7 +328,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
for
(
int
idx_subscene
=
0
;
idx_subscene
<
subscenes
.
size
();
idx_subscene
++
)
{
Spatial
*
subscene
=
subscenes
.
get
(
idx_subscene
);
float
dist
=
ray
.
cross
(
subscene
->
get_global_transform
().
origin
-
pos
).
length
();
float
dist
=
ray
.
cross
(
subscene
s_positions
.
get
(
idx_subscene
)
-
pos
).
length
();
if
((
dist
<
0
)
||
(
dist
>
1.2
))
continue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment