Hi!

I want to displace my mesh along normals using deformer. So I wrote
following code in compute method

        thisNode = self.thisMObject()

        index = plug.logicalIndex()
        inPlug = OpenMaya.MPlug( thisNode,
OpenMayaMPx.cvar.MPxDeformerNode_input )
        inPlug.selectAncestorLogicalIndex( index,
OpenMayaMPx.cvar.MPxDeformerNode_input )

        hInput = dataBlock.inputValue( inPlug )

        hGeom = hInput.child
( OpenMayaMPx.cvar.MPxDeformerNode_inputGeom )
        hGroup = hInput.child
( OpenMayaMPx.cvar.MPxDeformerNode_groupId )
        groupId = hGroup.asLong()
        hOutput = dataBlock.outputValue( plug )
        hOutput.copy( hGeom )

        pt = OpenMaya.MPoint()
        normalvec = OpenMaya.MVector()

        mesh = hOutput.data()
        iter = OpenMaya.MItMeshVertex(mesh)

        while iter.isDone() == False:
            pt = iter.position()
            iter.getNormal(normalvec)
            iter.setPosition(pt+normalvec*2)
            iter.next()

and I've got mesh distorted in random directions instead of normals.
When I replace normalvec with
some arbitrary vector everything is working fine. What I'm doing
wrong ?
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---

Reply via email to