I run into an issue, I created a compound array attribute with two children, an int array and mesh data attributes.
I copied here the part of the code, removed the unnecessary parts. I create a deformer and I connect the driver mesh into the “driverMesh” attribute.
The error I got this: # RuntimeError: (kFailure): Object does not exist //
@note: I found on internet other solutions to pull the data through plugs (it didn’t work either). Because of performance I try to use only DataBlock to pull the mesh data and avoid reading the plugs.
Anybody has any ideas what I’m doing wrong?
@staticmethod
def initialize():
tAttr = OpenMaya.MFnTypedAttribute()
cAttr = OpenMaya.MFnCompoundAttribute()
VertexSnap.aDriverMesh = tAttr.create('driverMesh', 'driverMesh', OpenMaya.MFnData.kMesh)
VertexSnap.aDriverIndices = tAttr.create('driverIndices', 'driverIndices', OpenMaya.MFnData.kIntArray)
VertexSnap.aDrivers = cAttr.create('drivers', 'drivers')
cAttr.setArray(True)
cAttr.addChild(VertexSnap.aDriverMesh)
cAttr.addChild(VertexSnap.aDriverIndices)
VertexSnap.addAttribute(VertexSnap.aDrivers)
outputGeom = OpenMayaMPx.cvar.MPxGeometryFilter_outputGeom
VertexSnap.attributeAffects(VertexSnap.aDriverMesh, outputGeom)
VertexSnap.attributeAffects(VertexSnap.aDriverIndices, outputGeom)
def deform(self, data, geoIter, localToWorldMatrix, geoIndex):
hDrivers = data.inputArrayValue(VertexSnap.aDrivers)
numDrivers = hDrivers.elementCount()
for driverIdx in range(numDrivers):
hDrivers.jumpToElement(driverIdx)
hDriver = hDrivers.inputValue()
oDriverMesh = hDriver.child(VertexSnap.aDriverMesh).asMesh()
if oDriverMesh.isNull():
return
fnDriverMesh = OpenMaya.MFnMesh(oDriverMesh)
print fnDriverMesh.name()
# I got this: # RuntimeError: (kFailure): Object does not exist //
Summary
This text will be hidden