import Blender
from Blender import NMesh, Object
# direction ==> Y=0 , X=1, Z=2
direction=2
Me=Object.GetSelected()
me=Me[0].getData()
me.hasVertexColours(1)
for f in me.faces:
for v in f.v:
c=Blender.NMesh.Col(int(v.no[direction]*127+128),
int(v.no[direction]*127+128),
int(v.no[direction]*127+128),
255)
try:
f.col[f.v.index(v)]=c
except:
f.col.append(None)
f.col[f.v.index(v)]=c
me.update()
Blender.Redraw() |