Hi! Sure, this is the complete code:

import maya.OpenMayaMPx as OpenMayaMPx
import maya.OpenMaya as OpenMaya
 
class BlendNode(OpenMayaMPx.MPxDeformerNode):
kPluginNodeId = OpenMaya.MTypeId(0x00000002)
 
aBlendMesh = OpenMaya.MObject()
aBlendWeight = OpenMaya.MObject()
 
def __init__(self):
OpenMayaMPx.MPxDeformerNode.__init__(self)

self.matchedVertices = {}


def compute(self, pPlug, data):

if pPlug == self.outputGeom:

iBlendMesh = data.inputValue(BlendNode.aBlendMesh).asMesh()
fnBlendMesh = OpenMaya.MFnMesh(iBlendMesh)

blendPoints = OpenMaya.MPointArray()
fnBlendMesh.getPoints(blendPoints)

outputMeshHandle = data.outputValue( self.outputGeom ).asMesh()
fnOutputMesh = OpenMaya.MFnMesh(outputMeshHandle)
outputPoints = OpenMaya.MPointArray()
fnOutputMesh.getPoints(outputPoints)
print outputPoints.length()

 
def deform(self, data, itGeo, localToWorldMatrix, mIndex):
pass

def creator():
return OpenMayaMPx.asMPxPtr(BlendNode())
 
def initialize():
tAttr = OpenMaya.MFnTypedAttribute()
nAttr = OpenMaya.MFnNumericAttribute()
 
BlendNode.aBlendMesh = tAttr.create('blendMesh', 'bm', 
OpenMaya.MFnData.kMesh)
BlendNode.addAttribute( BlendNode.aBlendMesh )
 
outputGeom = OpenMayaMPx.cvar.MPxDeformerNode_outputGeom
BlendNode.attributeAffects(BlendNode.aBlendMesh, outputGeom)
 
BlendNode.aBlendWeight = nAttr.create('blendWeight', 'bw', 
OpenMaya.MFnNumericData.kFloat)
nAttr.setKeyable(True)
BlendNode.addAttribute(BlendNode.aBlendWeight)
BlendNode.attributeAffects(BlendNode.aBlendWeight, outputGeom)
 
# Make deformer weights paintable
cmds.makePaintable('blendNode', 'weights', attrType='multiFloat', 
shapeMode='deformer')
 
def initializePlugin(obj):
plugin = OpenMayaMPx.MFnPlugin(obj, 'Chad Vernon', '1.0', 'Any')
try:
plugin.registerNode('blendNode', BlendNode.kPluginNodeId, creator, 
initialize, OpenMayaMPx.MPxNode.kDeformerNode)
except:
raise RuntimeError, 'Failed to register node'
 
def uninitializePlugin(obj):
plugin = OpenMayaMPx.MFnPlugin(obj)
try:
plugin.deregisterNode(BlendNode.kPluginNodeId)
except:
raise RuntimeError, 'Failed to deregister node'





Basically what I want to do is to compare the vertices of the input mesh 
and the output mesh and check which ones are in the same worldSpace, store 
them in a list, and perform the desired operations in the deform method, I 
want to move the matched output vertices to the input vertices as shown in 
the video I shared,

I'm stuck at reading the points from the output Mesh.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/e44d8aaf-a6fe-44bb-9241-e373874d8b54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to