Hi guys,

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():
  # No driver mesh
    return

  fnDriverMesh = OpenMaya.MFnMesh(oDriverMesh)
  print fnDriverMesh.name()
  # I got this: # RuntimeError: (kFailure): Object does not exist //

-- 
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/e32f3927-a3cd-4469-b3a2-9562c0b58906%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to