I have a node derived from MPxDeformerNode and I need to set some vertex colors inside its "deform" function.
I'm using MFnMesh's setVertexColors to do it, but the colors on the resulting mesh don't update on the viewport unless I force an evaluation for example by "dgdirty myNode1.outputGeometry[0];". The actual deformation updates just fine though.
You can see the same phenomenon in the next case also:
CODE
polySphere -ch 0;
polyCube -ch 0;
move -r 2 2 2;
setAttr "pSphereShape1.displayColors" 1;
setAttr "pCubeShape1.displayColors" 1;
connectAttr -f pSphereShape1.worldMesh[0] pCubeShape1.inMesh;
Execute the above first, so you now have the polySphere1 outputting its mesh to the polyCube1 and you can see the shape of the cube has been updated to a sphere.
Now change the colors of the polySphere1:
CODE
polyColorPerVertex -rgb 1.0 0.0 0.0 pSphereShape1;
And you see the pCube1 hasn't changed its color. The colors will update after:
CODE
dgdirty pSphereShape1;
What's also interesting is that if you connect the polySphere1 to polyCube1 by its outMesh instead of worldMesh[0], then there's no problem. So I assume that my deformer being connected by its outputGeometry[0] its problem is of a similar kind.
So how can I force this color information to propagate from inside my deform function? Any ideas. Thanks.