From 1ad2b73a74167fba84ee3094f2e7e04633c78ae2 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 15 Feb 2016 18:25:56 -0500 Subject: [PATCH] Don't wreck the layer selection in LM previews --- korman/operators/op_lightmap.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/korman/operators/op_lightmap.py b/korman/operators/op_lightmap.py index c058da4..01d313c 100644 --- a/korman/operators/op_lightmap.py +++ b/korman/operators/op_lightmap.py @@ -17,6 +17,7 @@ import bpy from bpy.props import * from ..exporter.etlight import LightBaker +from ..helpers import GoodNeighbor class _LightingOperator: @@ -37,8 +38,11 @@ class LightmapAutobakePreviewOperator(_LightingOperator, bpy.types.Operator): super().__init__() def execute(self, context): - bake = LightBaker() - bake.bake_static_lighting([context.active_object,]) + with GoodNeighbor() as toggle: + toggle.track(context.scene, "layers", tuple(context.scene.layers)) + + bake = LightBaker() + bake.bake_static_lighting([context.active_object,]) tex = bpy.data.textures.get("LIGHTMAPGEN_PREVIEW") if tex is None: