Creating A Colorset In A Node

hi all,

so i'm having an issue while trying to create a new node via maya/ python api that takes an input of a mesh and an out of a mesh (i.e. a simple through-put)...while in the node, it creates a new colorSet on the mesh. what could i be doing wrong with creating the colorSet? getting/ creating the wrong MFnMesh?

thanx in advance!

ps, i've also posted this and a complete dummy node for testing help on the googlePythonAPI forum:

http://groups.google.com/group/python\_insi...54b1ebcd9e53999

#----------------------------------------------------------

# get in
inMeshHnd = dataBlock.inputValue( myNode.inputGeometry ) # takes a mesh input
inMeshData = inMeshHnd.asMesh()

# get out
outMeshHnd = dataBlock.outputValue( myNode.outputGeometry ) # has a mesh output

# copy in to out
meshDataFn = OpenMaya.MFnMeshData()
newMeshData = meshDataFn.create()
inMeshFn = OpenMaya.MFnMesh( inMeshData )
inMeshFn.copy( inMeshData, newMeshData )

# create colorSet on mesh
colorSetNameString = "myNewColorSet"
inMeshFn.createColorSetWithName( colorSetNameString )

# output
outMeshHnd.setMObject( newMeshData )

Hi Paul,

So, we recently created a node to color verts for the outMesh attr based on some inputs.

We used a statement:

inMeshFn.createColorSetDataMesh( colorSetName );

to create the colorSet for the meshdata.

-It worked, but be aware, we ran into a problematic issue when daisy-chaining them together--only the last one in the chain would show up in the colorSet editor. Also, we couldn't find any docs on that method, either.

Eventually, we devised a HACK: to get around it...

BTW, C++ code with the API.

-Regards.
-bud

It has been a while, but it helped me a lot today :wink:
This one function actually works inside deformer, thanks!