summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2019-07-02 20:00:00 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2019-07-02 20:02:07 +0200
commit527fb3968a70e530468e5c96c910fab6051af344 (patch)
treed837c04a23b479631e5531587ec22908dafe9afd /editor
parentae65c610e783e8a4c89aa9c08eab884ba64e644c (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).
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp
index 87cb0d04a2..8cf09406c7 100644
--- a/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -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;