On 2011.07.22 02:35, John Patrick wrote:
For that matter, does anyone know of /any/ code examples (preferably c++, but Python is fine too) of setting poly vertex colors on an output DataHandle?

actually, I just use MFnMesh.setVertexColors(MColorArray,MIntArray). Tried fiddling around with color sets, but just couldn't find a right way to use them. One thing to note, there's nasty bug (confirmed by Autodesk) in 2010 maya that spams output with some warning eachtime using setVertexColor /setVertexColors, so a better choice would be to use setVertexColors() to minimize that spam.

all in all, i have a custom node that takes a mesh as an input, then using some custom plugin internal data figures out colors, and returns an output mesh that is identical to input except that it changes vertex colors. relevant code would be..

MDataHandle inMeshData = dataBlock.inputValue(ngLayerColorDisplayNode::attrInMesh); MDataHandle outMeshData = dataBlock.outputValue(ngLayerColorDisplayNode::attrOutMesh);

    outMeshData.copy(inMeshData);

//.. skipping code for calculating vertex colors into MColorArray

    MFnMesh meshFn(outMeshData.asMesh());
    meshFn.setVertexColors(this->currColors,this->vertexIndexes);
    dataBlock.setClean(plug);


--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to