From 34c28f3e870646ca792c3c0f4e6448b6b0817bd6 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 23 Jun 2015 18:09:35 -0400 Subject: [PATCH] Ensure ALL lights are baked... ... Not just the ones on the same layer(s) as the object. :/ --- korman/helpers.py | 5 ++++- korman/operators/op_export.py | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/korman/helpers.py b/korman/helpers.py index e6d74c0..7541a32 100644 --- a/korman/helpers.py +++ b/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 that the object will enter edit mode when requested.""" 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_render", False) toggle.track(bo, "hide_select", False) diff --git a/korman/operators/op_export.py b/korman/operators/op_export.py index 4d614c2..a081fcd 100644 --- a/korman/operators/op_export.py +++ b/korman/operators/op_export.py @@ -121,11 +121,16 @@ class _UiHelper: def __enter__(self): self.active_object = bpy.context.object self.selected_objects = bpy.context.selected_objects + self.layers = tuple(bpy.context.scene.layers) def __exit__(self, type, value, traceback): for i in bpy.data.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 :)