Browse Source

Don't bake shadows for objects with no drawables

I fail to understand why Blender thinks this is legit, but oh well...
Also, as a bonus, we no longer clobber values in the GoodNeighbor tracker.
I wonder how many bugs this will fix?
pull/38/head
Adam Johnson 9 years ago
parent
commit
7e387fda48
  1. 9
      korman/exporter/etlight.py
  2. 1
      korman/helpers.py

9
korman/exporter/etlight.py

@ -163,7 +163,10 @@ class LightBaker:
return None
def _has_valid_material(self, bo):
for material in bo.data.materials:
data = bo.data
if data is None or not isinstance(data, bpy.types.Mesh):
return False
for material in data.materials:
if material is not None:
return True
return False
@ -318,11 +321,15 @@ class LightBaker:
toggle.track(objs, "hide_render", False)
for i in bpy.data.objects:
i.select = i == objs
if not self._has_valid_material(i):
toggle.track(i, "hide_render", True)
else:
for i in bpy.data.objects:
value = i in objs
if value:
toggle.track(i, "hide_render", False)
elif not self._has_valid_material(i):
toggle.track(i, "hide_render", True)
i.select = value
@persistent

1
korman/helpers.py

@ -24,6 +24,7 @@ class GoodNeighbor:
return self
def track(self, cls, attr, value):
if (cls, attr) not in self._tracking:
self._tracking[(cls, attr)] = getattr(cls, attr)
setattr(cls, attr, value)

Loading…
Cancel
Save