I modified this script from tutorialsforblender3d.com to try and get it to work for 2.5, but when I try to use it on my character only some of the verts change colour. I’ve attached the blend, and here is the script:
import GameLogic as g # get controller cont = g.getCurrentController() # get object controller is attached to own = cont.owner # get the mesh mesh = own.meshes # get the number of materials on the mesh mats = mesh.numMaterials # cycle through all of the materials for i in range(0, mats): # get array length of the material array = mesh.getVertexArrayLength(i - 1) # loop through array for vertNum in range( 0, array): # get vertex vert = mesh.getVertex(0, vertNum) #Change the color color = [0.5, 0.5, 0.5, 1.0] # change vertex color vert.setRGBA(color)
Edit: It appears that most of the faces of my mesh go invisible in weight paint mode, and that only the few that are visible are the ones that get coloured in the game engine. Anyone know the cause and solution?
Edit 2: Cause: faces were on clip alpha for some reason. The faces that showed weren’t, because they were new ones as I’d redone some topology. Solution: set to opaque. I could do with that copy button right about now
Edit 3: after going through all 700 or so faces and setting it to opaque… it hasn’t worked. And I have no clue why. It seemed to work on the first I tried but now even less faces are changing colour.
Edit 4:Also, all the faces are on opaque, but acting as if they’re on alpha with buggy sorting! Argh! And enabling sorting actually ‘fixes’ this…? I think I may have to try and ‘copy’ this mesh somehow and lose all the data, just start again.
Edit 5: I redownloaded the file I put up here and am working on that again. Putting faces to opaque seems to be working again. I think it didn’t work last time because I tried to use the mirror modifier to save time. Ironic.
torin.blend (603 KB)