From c21b90f83c5b5e7ad1776bb9c74ffb1e060cc033 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 23 Jun 2015 16:05:59 -0400 Subject: [PATCH] Nuke old "autocolor" layers Old autocolor layers appear to cause some very terrible problems during export for some reason... --- korman/operators/op_lightmap.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/korman/operators/op_lightmap.py b/korman/operators/op_lightmap.py index 12ca02c..70e0c80 100644 --- a/korman/operators/op_lightmap.py +++ b/korman/operators/op_lightmap.py @@ -210,12 +210,16 @@ class VertexColorLightingOperator(_LightingOperator, bpy.types.Operator): def execute(self, context): with GoodNeighbor() as toggle: mesh = context.active_object.data + vcols = mesh.vertex_colors - # Find the "autocolor" vertex color layer - autocolor = mesh.vertex_colors.get("autocolor") - if autocolor is None: - mesh.vertex_colors.new("autocolor") - toggle.track(mesh.vertex_colors, "active", autocolor) + # I have heard tale of some moar "No valid image to bake to" boogs if there is a really + # old copy of the autocolor layer on the mesh. Nuke it. + autocolor = vcols.get("autocolor") + if autocolor is not None: + vcols.remove(autocolor) + + autocolor = vcols.new("autocolor") + toggle.track(vcols, "active", autocolor) # Mark "autocolor" as our active render layer for vcol_layer in mesh.vertex_colors: