|
Hello -
I’m writing a deformer which modifies UVs based on a source mesh. It is working but it does not immediatly update in response to changes in the deformer weight map (via painting weights or Edit Membership). I’ve verified that the deformer is being called and the UVs are being set (at least “setUVs” is being called with the correct UV values). The UVs do snap to the correct location if the source mesh is moved even a tiny bit, but until the source is tweaked there is no update as the weights are changing.
In my deform method I’m grabbing the outputGeom plug and creating an MFnMesh to do the modifications:
MStatus myDeformer::deform(MDataBlock& data, MItGeometry& geomIter,
const MMatrix& mat, unsigned int multiIdx )
{
MPlug outGeomPlugArray(thisMObject(), outputGeom )
MPlug outGeomPlug = outGeomPlugArray.elementByLogicalIndex( multiIndex )
MDataHandle outGeomHandle = data.outputValue( outGeomPlug )
MObject meshObj = outGeomHandle.asMesh()
// ... build UV arrays based on source mesh UVs and weight map
meshFn.setUVs( uArray, vArray )
meshFn.assignUVs( uvCounts, uvIds )
meshFn.updateSurface()
outGeoHandle.setClean()
}
Should this work? If so, any suggestions about what else might be wrong?
If not then I’d love to hear the proper way to make this type of modification.
Thanks!
|
|
|
|
There’s some strange behavior with deformers that prevents the UVs from updating. I created a UV modifying deformer and the only way I could get it to update interactively was to put another dependency node downstream such as a polyTweakUV node that doesn’t do anything.
|
|
|