I have a pretzel I need some cheese and mustard for...

So, I am trying to take a node and turn it into a deformer.  The
MPxDeformer route, for the most part looks/feels significantly cleaner
and easier to deal with, but I've run into this one weird thing.  I
don't know how to get all the information I need in the deform def,
specifically a vertex normal.  A deform gets this stuff:

def deform( self, dataBlock, itGeo, localToWorldMatrix, mIndex ):

And a compute gets this stuff:

def compute( self, plug, dataBlock ):

But the dataBlock for the compute has attributes *I* set up to get the
meshes connected, whereas in the dataBlock for the deform, there are
important attributes "magically" added that I'm not sure how to
interface with.  So, I've got the deform def working, minus one thing
- I need to do get at vertex normals, but am missing key information.
The way I did that in a compute def was (condensed to only the
relevant bits):

srcMesh     = dataBlock.inputValue( <node>.aSourceShape ).asMesh()
srcFnMesh = om.MFnMesh( srcMesh )
srcVerts     = om.MPointArray()
srcFnMesh.getPoints( srcVerts, om.MSpace.kWorld )
vertCount   = srcVerts.length()

getVector   = om.MVector()

for i in range( 0, vertCount ):
  srcFnMesh.getVertexNormal( i,
                                             False,
                                             getVector,
                                             om.MSpace.kWorld )

But I can't seem to figure out any way to set up an MFnMesh object to
allow this to work in the deform def, like it did in the compute,
because you're already passed a MItGeometry iterator (itGeo), from
which it seems tricky to find a mesh to work with.  In a compute, you
can get at attributes like a source mesh because it was defined by you
in the init, but in a deform's datablock, certain thing are "just
magically there".  How does one get at the *now orig* shape to set up
an MFnMesh with?

OR is there some other trick to getting at normal information while
working in an MItGeometry object (looks like all you can get is
position...)

Thanks!
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---

Reply via email to