Category Archives: Uncategorized

Setting polygon vertex colors quickly with the Maya Python API

Here's a little snippet I think I should save, and it might be useful for someone else out there too.
This is a way to set vertex colors on a mesh all at once, really quickly, using Python in Maya and the OpenMaya API
import maya.OpenMaya as OpenMaya
import pymel.core as pm
sel = pm.selected()[0]
shape = sel.getShape()
mobj = shape.__apimobject__()
meshFn = OpenMaya.MFnMesh(mobj)
vertexColorList = OpenMaya.MColorArray()
normalsList = OpenMaya.MFloatVectorArray()
meshFn.getVertexColors(vertexColorList)
meshFn.getNormals(normalsList)
lenVertexList = vertexColorList.length()
fnComponent = OpenMaya.MFnSingleIndexedComponent()
fullComponent = fnComponent.create( OpenMaya.MFn.kMeshVertComponent )
fnComponent.setCompleteData( lenVertexList );
vertexIndexList = OpenMaya.MIntArray()
fnComponent.getElements(vertexIndexList)
for k in range(lenVertexList):
    vertexColorList[k].r = normalsList[k].x
    vertexColorList[k].g = normalsList[k].y
    vertexColorList[k].b = normalsList[k].z
meshFn.setVertexColors(vertexColorList,vertexIndexList, None)

Old speed modelling images.

I just ran across some pics of a speed modelling project I did when I was teaching at Full Sail.  I think this one was a 2 or 3 hour dealy.  Back in my day we didn’t have ZBrush!  We modeled by hand, uphill both ways!

A bunch of older sketches!

I’m just going through old stuff and found these sketches from an older portfolio.  They are fun to look back on from time to time.