Okay, takeaway one is to go to those online docs, they are clearly
more updated. Smacks head.
I'm still curious, though, since there are 3 things on that page that
all say addAccept, and:
MStatus MFnGenericAttribute::addAccept( const MTypeId & id )
Doesn't say it's all dead/dying like the other two. How does one know
how to use it, or to steer clear of these three options:
MStatus MFnGenericAttribute::addAccept( const MTypeId & id )
# fine?
MStatus MFnGenericAttribute::addAccept( MFnData::Type newType )
# bad
MStatus MFnGenericAttribute::addAccept( MFnNumericData::Type newType )
# bad
And even after going to dig through the online docs, I still can't
figure out why this is dying:
def compute( self, plug, data ):
if ( plug != qWrapNode.aOutShape ):
return om.kUnknownParameter
sourceFnMesh = om.MFnMesh ( data.inputValue
( qWrapNode.aSourceShape ).asMesh() )
sources = om.MPointArray() # where to shoot rays from
outPoints = om.MPointArray() # where they hit
directions = om.MFloatVectorArray() # direction to shoot rays
sourceFnMesh.getPoints( sources, om.MSpace.kWorld )
sourceFnMesh.getPoints( outPoints, om.MSpace.kWorld )
sourceFnMesh.getNormals( directions, om.MSpace.kWorld )
# create distances table - assign negative distance
distances = om.MDoubleArray()
distances.setLength( directions.length() )
for i in range( 0, directions.length() ):
distances[ i ] = -1
targetsArrayHandle = data.inputArrayValue( qWrapNode.aTargetShapes )
targetsArrayHandle.jumpToElement(0)
for i in range( 0, targetsArrayHandle.elementCount() ):
targetMesh = targetsArrayHandle.inputValue().asMesh()
targetFnMesh = om.MFnMesh( targetMesh )
intersections = om.MPointArray()
for j in range( 0, directions.length() ):
targetFnMesh.intersect( sources[ j ],
directions[ j ],
intersections,
1.0e-10,
om.MSpace.kWorld,
None )
<rest cut for brevity>
It doesn't like "directions" for some reason, and gives me this:
# TypeError: in method 'MFnMesh_intersect', argument 3 of type
'MVector const &' //
Any ideas? And again, thanks to all who help. I would've given up on
this long ago without this group as a resource.
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---