Browse Source

Ensure ALL lights are baked...

... Not just the ones on the same layer(s) as the object. :/
pull/8/head
Adam Johnson 10 years ago
parent
commit
34c28f3e87
  1. 5
      korman/helpers.py
  2. 7
      korman/operators/op_export.py

5
korman/helpers.py

@ -36,7 +36,10 @@ def ensure_object_can_bake(bo, toggle):
"""Ensures that we can use Blender's baking operators on this object. Side effect: also ensures """Ensures that we can use Blender's baking operators on this object. Side effect: also ensures
that the object will enter edit mode when requested.""" that the object will enter edit mode when requested."""
scene = bpy.context.scene scene = bpy.context.scene
toggle.track(scene, "layers", bo.layers) # we don't toggle.track this because it actually updates some kind of Blender internals...
# therefore the old and new value are equal. the export operator will take care of this for us
scene.layers = (True,) * len(scene.layers)
toggle.track(bo, "hide", False) toggle.track(bo, "hide", False)
toggle.track(bo, "hide_render", False) toggle.track(bo, "hide_render", False)
toggle.track(bo, "hide_select", False) toggle.track(bo, "hide_select", False)

7
korman/operators/op_export.py

@ -121,11 +121,16 @@ class _UiHelper:
def __enter__(self): def __enter__(self):
self.active_object = bpy.context.object self.active_object = bpy.context.object
self.selected_objects = bpy.context.selected_objects self.selected_objects = bpy.context.selected_objects
self.layers = tuple(bpy.context.scene.layers)
def __exit__(self, type, value, traceback): def __exit__(self, type, value, traceback):
for i in bpy.data.objects: for i in bpy.data.objects:
i.select = (i in self.selected_objects) i.select = (i in self.selected_objects)
bpy.context.scene.objects.active = self.active_object
scene = bpy.context.scene
scene.objects.active = self.active_object
scene.layers = self.layers
scene.update()
# Add the export operator to the Export menu :) # Add the export operator to the Export menu :)

Loading…
Cancel
Save