Skip to content

Commit

Permalink
Merge pull request #312 from Jrius/polygon_vcol_cleaning_fix
Browse files Browse the repository at this point in the history
Fix vcol cleaning bug with polygons
  • Loading branch information
Hoikas authored Jan 2, 2022
2 parents e3a3163 + e5a1e72 commit d9abf79
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions korman/exporter/etlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,15 @@ def _fix_vertex_colors(self, blender_objects):
# 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:
Expand Down

0 comments on commit d9abf79

Please sign in to comment.