|
|
|
@ -201,19 +201,13 @@ class LightBaker:
|
|
|
|
|
# (If the object has an edge split modifier, well, screw you!) |
|
|
|
|
for bo in blender_objects: |
|
|
|
|
mesh = bo.data |
|
|
|
|
bm = bmesh.new() |
|
|
|
|
bm.from_mesh(mesh) |
|
|
|
|
|
|
|
|
|
light_vcol = bm.loops.layers.color.get(self.vcol_layer_name) |
|
|
|
|
|
|
|
|
|
# If no vertex color is found, then baking either failed (error raised by oven) |
|
|
|
|
# or is turned off. Either way, bail out. |
|
|
|
|
if light_vcol is None: |
|
|
|
|
bm.free() |
|
|
|
|
del bm |
|
|
|
|
if self.vcol_layer_name not in mesh.vertex_colors: |
|
|
|
|
# No vertex color. Baking either failed or is turned off. |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
with bmesh_from_object(bo) as bm: |
|
|
|
|
bm.faces.ensure_lookup_table() |
|
|
|
|
light_vcol = bm.loops.layers.color.get(self.vcol_layer_name) |
|
|
|
|
|
|
|
|
|
for face in bm.faces: |
|
|
|
|
for loop in face.loops: |
|
|
|
@ -227,9 +221,10 @@ class LightBaker:
|
|
|
|
|
if len(edge.link_faces) != 2: |
|
|
|
|
# Either a border edge, or an abomination. |
|
|
|
|
continue |
|
|
|
|
if not edge.smooth or (mesh.use_auto_smooth and |
|
|
|
|
edge.calc_face_angle() > mesh.auto_smooth_angle): |
|
|
|
|
# Sharp edge. Don't care. |
|
|
|
|
if mesh.use_auto_smooth and (not edge.smooth |
|
|
|
|
or edge.calc_face_angle() > mesh.auto_smooth_angle): |
|
|
|
|
# Normals are split for edges marked as sharp by the user, and edges |
|
|
|
|
# whose angle is above the theshold. Auto smooth must be on in both cases. |
|
|
|
|
continue |
|
|
|
|
if face in edge.link_faces: |
|
|
|
|
# Alright, this edge is connected to our loop AND our face. |
|
|
|
@ -247,8 +242,6 @@ class LightBaker:
|
|
|
|
|
loop[light_vcol] = max_color |
|
|
|
|
|
|
|
|
|
bm.to_mesh(mesh) |
|
|
|
|
bm.free() |
|
|
|
|
del bm |
|
|
|
|
|
|
|
|
|
def _generate_lightgroup(self, bo, user_lg=None): |
|
|
|
|
"""Makes a new light group for the baking process that excludes all Plasma RT lamps""" |
|
|
|
|