From db4ef98586546a34492368bf4c95264b0a6017c8 Mon Sep 17 00:00:00 2001 From: SebastianWitt Date: Fri, 13 Oct 2023 23:05:15 +0200 Subject: [PATCH] Prevent division by zero on small ngons unwrap --- scripts/startup/bl_operators/uvcalc_lightmap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/startup/bl_operators/uvcalc_lightmap.py b/scripts/startup/bl_operators/uvcalc_lightmap.py index a24d8d5320c..bbb6c0630e1 100644 --- a/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -114,8 +114,10 @@ class prettyface: # ngons work different, we store projected result # in UVs to avoid having to re-project later. for i, co in enumerate(cos_2d): - self.uv[i][:] = ((co.x - xmin) / xspan, - (co.y - ymin) / yspan) + if xspan < 0.0000001 or yspan < 0.0000001: + self.uv[i][:] = (0, 0) + else: + self.uv[i][:] = ((co.x - xmin) / xspan, (co.y - ymin) / yspan) self.children = [] -- 2.30.2