Thanks Viktoras (sorry for the delay).

I just wanted to report back that there were two tricks to creating color
sets and setting colors on those color sets.

The first is that if you have an MFnMesh with an MObject from an attribute,
you can't create a color set using the normal method.  Instead, there is an
undocumented method in the MFnMesh header file called
"createColorSetDataMesh(setName)".

The second trick (or realization) was that you can't actually "set" a color
set from in the node's compute method, at least not when the MFnMesh's
MObject is an attribute.  Most of the setColor methods set colors on the
*current* color set, but setColors and assignColors both take an optional
color set arg.  So to set the colors for myColorSet:

meshFn.setColors(MColorArray of colors in per-face, per-vertex order,
colorSetName)
meshFn.assignColors(colorIndexArray)

the colorIndexArray is an MIntArray of the index in the MColorArray for
which each vace-vert will get assigned. In other words, in this case, it
just an ordered list from 0-numFaceVerts.  I'm assuming this is for
efficiency, so that if you only were using 2 different colors on a mesh, you
could do (in pseudo code):

MFn.setColors(MColorArray(Color1, Color2), myColorSet)
MFn.assignColors(indexArray(0,1,1,1,0...), myColorSet), where
indexArray.length() == MFn.numFaceVertices()

So, hopefully that helps if someone happens to Google this later ;)


On Sat, Jul 23, 2011 at 9:52 AM, Viktoras <[email protected]> wrote:

> On 2011.07.22 18:16, John Patrick wrote:
>
>> 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?
>>
>>  you mean .data(), as in MDataHandle.data() ? That method is for
> retreiving handle values for custom data types, the ones you can create via
> MPxData.
>
>
> --
> view archives: 
> http://groups.google.com/**group/python_inside_maya<http://groups.google.com/group/python_inside_maya>
> change your subscription settings: http://groups.google.com/**
> group/python_inside_maya/**subscribe<http://groups.google.com/group/python_inside_maya/subscribe>
>



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