Okay, so good news/bad news.  I can set colors on whatever the current color
set is.  In fact, I was actually doing it the whole time, I just didn't have
the display vertex colors option turned on for my shape (doh!!).

The color sets thing is a real problem though.  There must be a way to do
this...

On Fri, Jul 22, 2011 at 8:16 AM, John Patrick <[email protected]> wrote:

> Thanks Viktoras, I'll give setting the colors that way a shot.
>
> As a side note, do you know what the difference is between:
>
> MFnMesh meshFn(outMeshData.asMesh())  vs  MFnMesh
> meshFn(outMeshData.asData())?
>
> Both asData() and asMesh ()return an MObject, but I'm wondering if that
> MObject is pointing to different data?
>
> Anyways, once I get into work I'll give it a shot and report back.
>
>
> On Fri, Jul 22, 2011 at 1:27 AM, Viktoras <[email protected]> wrote:
>
>>  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
>>
>
>
>
> --
> John Patrick
> 404-242-2675
> [email protected]
> http://www.canyourigit.com
>



-- 
John Patrick
404-242-2675
[email protected]
http://www.canyourigit.com

-- 
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