Skip to content

Commit 3ed604f

Browse files
committed
Fix lightmap baking
1 parent 8c74677 commit 3ed604f

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

korman/exporter/mesh.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,8 @@ def __enter__(self):
215215
mod_prop_dict = self._build_prop_dict(mod)
216216
cache_mods.append(mod_prop_dict)
217217

218-
armatures = []
219-
for armature_mod in self._exporter().armature.get_skin_modifiers(i):
220-
# We'll use armatures to export bones later. Disable it so it doesn't get baked into the mesh.
221-
armatures.append(armature_mod.object)
222-
# Note that this gets reverted when we reapply cached modifiers.
223-
armature_mod.show_render = False
224-
if armatures:
225-
self._objects_armatures[i.name] = armatures
218+
# Disable armatures if need be (only when exporting)
219+
self._disable_armatures(i)
226220

227221
i.data = i.to_mesh(scene, True, "RENDER", calc_tessface=False)
228222

@@ -254,6 +248,10 @@ def __exit__(self, *exc_info):
254248
setattr(mod, key, value)
255249
self._entered = False
256250

251+
def _disable_armatures(self, bo):
252+
# Overridden when necessary.
253+
pass
254+
257255
def is_collapsed(self, bo) -> bool:
258256
return bo.name in self._overrides
259257

@@ -371,6 +369,16 @@ def is_alpha_blended(layer):
371369

372370
return geospan
373371

372+
def _disable_armatures(self, bo):
373+
armatures = []
374+
for armature_mod in self._exporter().armature.get_skin_modifiers(bo):
375+
# We'll use armatures to export bones later. Disable it so it doesn't get baked into the mesh.
376+
armatures.append(armature_mod.object)
377+
# Note that this gets reverted when we reapply cached modifiers.
378+
armature_mod.show_render = False
379+
if armatures:
380+
self._objects_armatures[bo.name] = armatures
381+
374382
def finalize(self):
375383
"""Prepares all baked Plasma geometry to be flushed to the disk"""
376384
self._report.progress_advance()

0 commit comments

Comments
 (0)