I’ve never done any Blender scripting. However, I must have an A channel for vertex colors, for the games I make, and Blender does not provide for me as-is. My best idea so far is to use a second vertex color set and use it as the alpha. This node-based system works for display in Blender, but it does not export. If you could provide me with any tips on how to combine the two, I would really appreciate it.
Also, the title of this thread is “Combining”. Sorry, I forgot to finish the title. I’d edit it, but the forum software doesn’t seem to allow this. I sense a theme developing.
Here’s what I’ve come up with so far. I can’t figure out why I can’t set just one color channel, in a loop (but I never used Python before tonight), and I have no idea why the colors aren’t put in the right order.
scene = bpy.data.scenes.active
selection = scene.objects.active
mesh = selection.getData(mesh=1)
mesh.activeColorLayer = (‘RGB’)
for i, rgbFace in enumerate(mesh.faces):
rgbColors = rgbFace.col
mesh.activeColorLayer = (‘Alpha’)
for i, alphaFace in enumerate(mesh.faces):
alphaColors = alphaFace.col
mesh.activeColorLayer = (‘RGBA’)
for i, rgbaFace in enumerate(mesh.faces):
rgbaFace.col = rgbColors
rgbaFace.col.a = alphaColors.a #why doesn’t this work?
The 2.5 scripting documentation shows that there isn’t an alpha channel for vertex colors. However, they need to be exported via FBX in order to work with Unity. As it is, 2.5 and FBX are not yet friendly at all, apparently.
Not that anybody else cares, but this guy fixed it. I’m extremely happy.