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
527fb396
Unverified
Commit
527fb396
authored
Jul 02, 2019
by
Hugo Locurcio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement snapping in the CSG gizmos and 3D polygon editor
The spatial editor snap settings will now affect the CSG gizmos and 3D polygon editor (which is used in CSGPolygon).
parent
ae65c610
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
collision_polygon_editor_plugin.cpp
editor/plugins/collision_polygon_editor_plugin.cpp
+4
-2
csg_gizmos.cpp
modules/csg/csg_gizmos.cpp
+14
-0
No files found.
editor/plugins/collision_polygon_editor_plugin.cpp
View file @
527fb396
...
...
@@ -346,8 +346,10 @@ bool Polygon3DEditor::forward_spatial_gui_input(Camera *p_camera, const Ref<Inpu
snap_ignore
=
false
;
}
if
(
!
snap_ignore
)
{
cpoint
=
CanvasItemEditor
::
get_singleton
()
->
snap_point
(
cpoint
);
if
(
!
snap_ignore
&&
SpatialEditor
::
get_singleton
()
->
is_snap_enabled
())
{
cpoint
=
cpoint
.
snapped
(
Vector2
(
SpatialEditor
::
get_singleton
()
->
get_translate_snap
(),
SpatialEditor
::
get_singleton
()
->
get_translate_snap
()));
}
edited_point_pos
=
cpoint
;
...
...
modules/csg/csg_gizmos.cpp
View file @
527fb396
...
...
@@ -120,6 +120,10 @@ void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i
Vector3
ra
,
rb
;
Geometry
::
get_closest_points_between_segments
(
Vector3
(),
Vector3
(
4096
,
0
,
0
),
sg
[
0
],
sg
[
1
],
ra
,
rb
);
float
d
=
ra
.
x
;
if
(
SpatialEditor
::
get_singleton
()
->
is_snap_enabled
())
{
d
=
Math
::
stepify
(
d
,
SpatialEditor
::
get_singleton
()
->
get_translate_snap
());
}
if
(
d
<
0.001
)
d
=
0.001
;
...
...
@@ -135,6 +139,10 @@ void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i
Vector3
ra
,
rb
;
Geometry
::
get_closest_points_between_segments
(
Vector3
(),
axis
*
4096
,
sg
[
0
],
sg
[
1
],
ra
,
rb
);
float
d
=
ra
[
p_idx
];
if
(
SpatialEditor
::
get_singleton
()
->
is_snap_enabled
())
{
d
=
Math
::
stepify
(
d
,
SpatialEditor
::
get_singleton
()
->
get_translate_snap
());
}
if
(
d
<
0.001
)
d
=
0.001
;
...
...
@@ -154,6 +162,9 @@ void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i
Vector3
ra
,
rb
;
Geometry
::
get_closest_points_between_segments
(
Vector3
(),
axis
*
4096
,
sg
[
0
],
sg
[
1
],
ra
,
rb
);
float
d
=
axis
.
dot
(
ra
);
if
(
SpatialEditor
::
get_singleton
()
->
is_snap_enabled
())
{
d
=
Math
::
stepify
(
d
,
SpatialEditor
::
get_singleton
()
->
get_translate_snap
());
}
if
(
d
<
0.001
)
d
=
0.001
;
...
...
@@ -173,6 +184,9 @@ void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i
Vector3
ra
,
rb
;
Geometry
::
get_closest_points_between_segments
(
Vector3
(),
axis
*
4096
,
sg
[
0
],
sg
[
1
],
ra
,
rb
);
float
d
=
axis
.
dot
(
ra
);
if
(
SpatialEditor
::
get_singleton
()
->
is_snap_enabled
())
{
d
=
Math
::
stepify
(
d
,
SpatialEditor
::
get_singleton
()
->
get_translate_snap
());
}
if
(
d
<
0.001
)
d
=
0.001
;
...
...
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