|
|
@ -210,12 +210,16 @@ class VertexColorLightingOperator(_LightingOperator, bpy.types.Operator): |
|
|
|
def execute(self, context): |
|
|
|
def execute(self, context): |
|
|
|
with GoodNeighbor() as toggle: |
|
|
|
with GoodNeighbor() as toggle: |
|
|
|
mesh = context.active_object.data |
|
|
|
mesh = context.active_object.data |
|
|
|
|
|
|
|
vcols = mesh.vertex_colors |
|
|
|
|
|
|
|
|
|
|
|
# Find the "autocolor" vertex color layer |
|
|
|
# I have heard tale of some moar "No valid image to bake to" boogs if there is a really |
|
|
|
autocolor = mesh.vertex_colors.get("autocolor") |
|
|
|
# old copy of the autocolor layer on the mesh. Nuke it. |
|
|
|
if autocolor is None: |
|
|
|
autocolor = vcols.get("autocolor") |
|
|
|
mesh.vertex_colors.new("autocolor") |
|
|
|
if autocolor is not None: |
|
|
|
toggle.track(mesh.vertex_colors, "active", autocolor) |
|
|
|
vcols.remove(autocolor) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
autocolor = vcols.new("autocolor") |
|
|
|
|
|
|
|
toggle.track(vcols, "active", autocolor) |
|
|
|
|
|
|
|
|
|
|
|
# Mark "autocolor" as our active render layer |
|
|
|
# Mark "autocolor" as our active render layer |
|
|
|
for vcol_layer in mesh.vertex_colors: |
|
|
|
for vcol_layer in mesh.vertex_colors: |
|
|
|