From e5a1e720f727bcb4a788375bf171ca7d5674a4a7 Mon Sep 17 00:00:00 2001 From: Jrius <2261279+Jrius@users.noreply.github.com> Date: Sun, 2 Jan 2022 17:19:20 +0100 Subject: [PATCH] Vertex color cleaning: ignore convex loops --- korman/exporter/etlight.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/korman/exporter/etlight.py b/korman/exporter/etlight.py index 8b8a67d..21c21a9 100644 --- a/korman/exporter/etlight.py +++ b/korman/exporter/etlight.py @@ -242,9 +242,15 @@ class LightBaker: # Now for the Fun Stuff(c)... First, actually get ahold of the other # face (the one we're connected to via this edge). other_face = next(f for f in edge.link_faces if f != face) + if not other_face.calc_area(): + # Zero area face, ignore it. + continue # Now get ahold of the loop sharing our vertex on the OTHER SIDE # of that damnable edge... other_loop = next(loop for loop in other_face.loops if loop.vert == vert) + if not other_loop.is_convex: + # Happens with complex polygons after edge dissolving. Ignore it. + continue other_color = other_loop[light_vcol] # Phew ! Good, now just pick whichever color has the highest average value if sum(max_color) / 3 < sum(other_color) / 3: