Browse Source

Vertex color cleaning: ignore convex loops

pull/312/head
Jrius 3 years ago
parent
commit
e5a1e720f7
  1. 6
      korman/exporter/etlight.py

6
korman/exporter/etlight.py

@ -242,9 +242,15 @@ class LightBaker:
# Now for the Fun Stuff(c)... First, actually get ahold of the other # Now for the Fun Stuff(c)... First, actually get ahold of the other
# face (the one we're connected to via this edge). # face (the one we're connected to via this edge).
other_face = next(f for f in edge.link_faces if f != face) 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 # Now get ahold of the loop sharing our vertex on the OTHER SIDE
# of that damnable edge... # of that damnable edge...
other_loop = next(loop for loop in other_face.loops if loop.vert == vert) 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] other_color = other_loop[light_vcol]
# Phew ! Good, now just pick whichever color has the highest average value # Phew ! Good, now just pick whichever color has the highest average value
if sum(max_color) / 3 < sum(other_color) / 3: if sum(max_color) / 3 < sum(other_color) / 3:

Loading…
Cancel
Save