From 4dc2ca8756993633974478adad41071fc12dbc3f Mon Sep 17 00:00:00 2001 From: Joseph Moon Date: Sat, 30 Mar 2019 03:03:04 -0700 Subject: [PATCH] Add shape reflection to Polygon2D UV editor --- editor/plugins/polygon_2d_editor_plugin.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 0dbbaf417793..d5bcc26a84f9 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -886,11 +886,13 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { if (from_dist < 2) break; + Vector2 rel_center = uv_drag_to - mtx.xform(center); + Vector2 reflect = Vector2((rel_center.x >= 0) ? 1 : -1, (rel_center.y >= 0) ? 1 : -1); float scale = to_dist / from_dist; for (int i = 0; i < uv_new.size(); i++) { Vector2 rel = points_prev[i] - center; - rel = rel * scale; + rel = rel * scale * reflect; uv_new.set(i, center + rel); }