Browse Source

Fix many "no valid images found to bake to" bugs

pull/6/head
Adam Johnson 10 years ago
parent
commit
d303faced6
  1. 10
      korman/exporter/mesh.py
  2. 9
      korman/operators/op_lightmap.py

10
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("====")

9
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)

Loading…
Cancel
Save