Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® Maya® / SDK / UV update from deformer?
  RSS 2.0 ATOM  

UV update from deformer?
Rate this thread
 
34281
 
Permlink of this thread   Subscribe to this thread
avatar
  • roytm
  • Posted: 10 September 2009 07:26 AM
  • Total Posts: 2
  • Joined: 10 September 2009 02:06 PM

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(MDataBlockdataMItGeometrygeomIter
                           const 
MMatrixmatunsigned 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( uArrayvArray )
    meshFn
.assignUVs( uvCountsuvIds )
    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!



Replies: 0
avatar
  • chadmv
  • Posted: 29 October 2009 05:27 AM

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.



Replies: 0




   
  Settings Choose Theme color: