diff --git a/korman/exporter/mesh.py b/korman/exporter/mesh.py index 9a762c1..bb41ae1 100644 --- a/korman/exporter/mesh.py +++ b/korman/exporter/mesh.py @@ -293,7 +293,15 @@ class MeshConverter: return geospans def _export_static_lighting(self, bo): - context = {"active_object": bo, "object": bo} + context = {"active_object": bo, + "area": bpy.context.area, + "blend_data": bpy.context.blend_data, + "object": bo, + "region": bpy.context.region, + "scene": bpy.context.scene, + "screen": bpy.context.screen, + "window": bpy.context.window} + if bo.plasma_modifiers.lightmap.enabled: print(" Baking lightmap...") print("====") diff --git a/korman/operators/op_lightmap.py b/korman/operators/op_lightmap.py index e8fa33e..aaaed46 100644 --- a/korman/operators/op_lightmap.py +++ b/korman/operators/op_lightmap.py @@ -105,11 +105,15 @@ class LightmapAutobakeOperator(_LightingOperator, bpy.types.Operator): for uvtex in mesh.uv_textures: if uvtex.name == "LIGHTMAPGEN": toggle.track(mesh.uv_textures, "active", uvtex) + toggle.track(uvtex, "active_render", True) break + else: + toggle.track(uvtex, "active_render", False) else: # Gotta make it uvtex = mesh.uv_textures.new("LIGHTMAPGEN") toggle.track(mesh.uv_textures, "active", uvtex) + toggle.track(uvtex, "active_render", True) # Now, enter edit mode on this mesh and unwrap. bpy.ops.object.mode_set(mode="EDIT") @@ -177,6 +181,11 @@ class VertexColorLightingOperator(_LightingOperator, bpy.types.Operator): mesh.vertex_colors.new("autocolor") toggle.track(mesh.vertex_colors, "active", autocolor) + # Mark "autocolor" as our active render layer + for vcol_layer in mesh.vertex_colors: + autocol = vcol_layer.name == "autocolor" + toggle.track(vcol_layer, "active_render", autocol) + # Bake settings render = context.scene.render toggle.track(render, "use_bake_to_vertex_color", True)