Hi all
i need to translate each the vertices of a selected object to the position in world space represented by their vertex color. So basically take RGB color and make it XYZ position for all the verts.
I have this maya.cmds version that works fine, except it's massively slow on any geo with more than about 5000 vertices:
#-------------
import maya.cmds as mc
myVerts =
mc.ls('%s.vtx[:]' % selObjs[0], fl=True)
for vert in myVerts:
col = mc.polyColorPerVertex(vert, query=True, rgb=True )
mc.move(col[0], col[1], col[2], vert, rpr=1, ws=1)
#---------
Now i'm trying to figure out how to do this with openMaya to speed things up a bit, but having never used that Python API i'm having a bit of trouble.
Seems i need to get the vert color list using getVertexColors then set the positions using setPoints, somehow needing to translate the MColorArray to an MPointArray...
Anyone have a simple way of doing this?
Cheers