From 100f50b7df7312f8fc56df7fd3e18427678bd957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 13 Jan 2020 12:13:45 +0100 Subject: Control/Light2D: Preventing setting 0 as scale as for Node2D Triggers errors in `Transform2D::affine_invert()`. Fixes #26510. Fixes https://github.com/godotengine/godot/issues/24997#issuecomment-457951639. --- scene/gui/control.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scene/gui/control.cpp') diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 9a67745e0d..4f499af186 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2682,6 +2682,11 @@ Vector2 Control::get_pivot_offset() const { void Control::set_scale(const Vector2 &p_scale) { data.scale = p_scale; + // Avoid having 0 scale values, can lead to errors in physics and rendering. + if (data.scale.x == 0) + data.scale.x = CMP_EPSILON; + if (data.scale.y == 0) + data.scale.y = CMP_EPSILON; update(); _notify_transform(); } -- cgit v1.2.3