I need to be able to import vertex colors into blender. I was trying to modify the append_faces method in mesh_tools.py to be able to import this information. After the if statement that sets the UV info I added the following block of code:
if len(vertcols) > 1: color = vertcols[index] c = Blender.NMesh.Col(int(color),int(color),int(color),int(color)) if face.col == None or len(face.col) < 1: face.col = [Blender.NMesh.Col()]*4 face.col[j].r = c.r face.col[j].g = c.g face.col[j].b = c.b face.col[j].a = 255 print "setting color to: ",c.r,c.g,c.b
Also, in the create_mesh method I added the following code after the object is named:
if len(vertcols) > 1: Blender.Mesh.Get(objname).vertexColors = 1
vertcols= was added as a parameter to create_mesh and vertcols was added as a parameter to append_faces .
The print statement at the end of the first block of code prints that it is indeed setting the correct colors, however, when I enter vertex color mode on the newly imported object (‘v’) or textured display (Alt+Z) the object is colored completely black. The mesh that is being used in append_faces is generated by Blender.NMesh.GetRaw() .
Does anyone have an idea as to why my vertex colors are not displaying?