import maya.cmds as cmds import maya.OpenMaya as om sel = om.MSelectionList() om.MGlobal.getActiveSelectionList(sel) vertexColorList = om.MColorArray() vertexIndexList = om.MIntArray() dagPath = om.MDagPath() component = om.MObject() iter = om.MItSelectionList(sel) while not iter.isDone(): iter.getDagPath( dagPath, component ) meshFn = om.MFnMesh(dagPath) meshIter = om.MItMeshVertex( dagPath, component ) index = 0 while not meshIter.isDone(): point = meshIter.position(om.MSpace.kWorld) color = om.MColor(point.x,point.y,point.z,1) vertexColorList.append(color) vertexIndexList.append(index) index = index +1 meshIter.next() meshFn.setVertexColors(vertexColorList,vertexIndexList ) iter.next()author: Jan Lachauer
Montag, 30. September 2013
bake world position to vertex color
This script bake the vertex position in world space into the vertex color.
Just select the objects and run the script
Abonnieren
Posts (Atom)