Lightmap unwrap improvements - prevent division by zero #113716

Closed
Sebastian Witt wants to merge 1 commits from SebastianWitt/blender:Ligthmap_zero_div into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 4 additions and 2 deletions

View File

@ -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:
Review

Is there a standard "epsilon" value to use instead?

Is there a standard "epsilon" value to use instead?
Review

There is sys.float_info.epsilon but it's ~2.2e-16 and often too small to be useful.

There is `sys.float_info.epsilon` but it's ~`2.2e-16` and often too small to be useful.
self.uv[i][:] = (0, 0)
else:
self.uv[i][:] = ((co.x - xmin) / xspan, (co.y - ymin) / yspan)
self.children = []