Ok your running into a non script support issue again. data.outputValue( qWrapNode.aOutShape ) outputValue.set( outMeshData ) data.setClean( qWrapNode.aOutShape )
outputValue is a MDataHandle class object and the .set() function is not available to Python. Here is try this, im not sure if its the right set object but it should be: data.outputValue( qWrapNode.aOutShape ) outputValue.setMObject( outMeshData ) data.setClean( qWrapNode.aOutShape ) outMeshData looks like it should be a MObject class object so that is what you need to set. Check out the MDataHandle document if that doesnt work and try other functions. There is a big list: void setBool ( bool ) void setChar ( char ) void setShort ( short ) void setInt ( int ) void setFloat ( float ) void setDouble ( double ) void setMMatrix ( const MMatrix & ) void setMFloatMatrix ( const MFloatMatrix & ) void setMVector ( const MVector & ) void setMFloatVector ( const MFloatVector & ) void setMDistance ( const MDistance & ) void setMAngle ( const MAngle & ) void setMTime ( const MTime & ) void set2Short ( short, short ) void set2Int ( int, int ) void set2Float ( float, float ) void set2Double ( double, double ) void set3Short ( short, short, short ) void set3Int ( int, int, int ) void set3Float ( float, float, float ) void set3Double ( double, double, double ) void setString ( const MString &) MStatus setMObject ( const MObject & data ) MStatus setMPxData ( MPxData * data ) bool asGenericBool () const unsigned char asGenericChar () const double asGenericDouble () const float asGenericFloat () const short asGenericShort () const int asGenericInt () const void setGenericBool ( bool value, bool force ) void setGenericChar ( unsigned char value, bool force ) void setGenericDouble ( double value, bool force ) void setGenericFloat ( float value, bool force ) void setGenericShort ( short value, bool force ) void setGenericInt ( int value, bool force ) RyanT Technical Artist NaughtyDog Inc. www.rtrowbridge.com/blog On Feb 11, 9:15 am, jasonosipa <jason.os...@gmail.com> wrote: > So, there really was something wrong with the intersection line, (I > did have Echo All and Stack Trace, and Line numbers visible, I only > posted the information that seemed pertinent). I never did figured > out what it was, so I just gave up and went to > MFnMesh.closestIntersection, because I know how to make that work, and > I'll get the same information back. Now, the whole thing seems to be > running great until the very very very end, where I try to "set" the > outMesh just like in qWrap, but it poops... Here's the entire > compute: > > def compute( self, plug, data ): > > if ( plug != qWrapNode.aOutShape ): > return om.kUnknownParameter > > sourceMesh = data.inputValue( qWrapNode.aSourceShape )\ > .asMesh() > sourceFnMesh = om.MFnMesh( sourceMesh ) > > maxParam = data.inputValue ( qWrapNode.aMaxDistance ) > maxDist = maxParam.asFloat() > > 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() ) > > distances = [ -1 for i in range( 0, directions.length() ) ] > > targetsArrayHandle = data.inputArrayValue( qWrapNode.aTargetShapes ) > > for i in range( 0, targetsArrayHandle.elementCount() ): > > targetsArrayHandle.jumpToElement( i ) > > targetMesh = om.MObject( targetsArrayHandle.inputValue()\ > .asMesh() ) > #targetMesh = targetsArrayHandle.inputValue().asMesh() > targetFnMesh = om.MFnMesh( targetMesh ) > intersections = om.MPointArray() > > for j in range( 0, directions.length() ): > > raySource = om.MFloatPoint( sources[ j ][0], > sources[ j ][1], > sources[ j ][2] ) > > rayDirection = om.MFloatVector( directions[ j ][0], > directions[ j ][1], > directions[ j ][2] ) > > hitPoint = om.MFloatPoint() > > gotHit = targetFnMesh.closestIntersection( > raySource, rayDirection, > None, None, False, > om.MSpace.kWorld, maxDist, > False, None, > hitPoint, > None, None, None, None, None ) > > if gotHit: > > delly = om.MVector( sources[ j ] - hitPoint ) > distance = delly.length().asFloat() > > if ( ( distance < distances[ j ] ) > or ( distances[ j ] == -1 ) ): > distances[ j ] = distance > outPoints[ j ] = hitPoint > > # modify points by "amount" and "maxDistance" > maxDistance = data.inputValue( \ > qWrapNode.aMaxDistance )\ > .asDouble() > > amount = data.inputValue( qWrapNode.aAmount ).asDouble() > > for i in range( 0, outPoints.length() ): > > delly = om.MVector( sources[ i ] - outPoints[ i ] ) > distance = delly.length() > > distMix = 1 > > if ( distance != 0 ): > distMix = min( 1, max( 0, maxDistance / distance ) ) > > outPoints[ i ] = sources [ i ] \ > + ( outPoints[ i ] - sources[ i ] ) \ > * distMix * amount > > # create output > outFnMeshData = om.MFnMeshData() > outMeshData = outFnMeshData.create() > outFnMesh = om.MFnMesh() > outFnMesh.copy( sourceMesh, outMeshData ) > outFnMesh.setPoints( outPoints ) > > # store it > data.outputValue( qWrapNode.aOutShape ).set( outMeshData ) > data.setClean( qWrapNode.aOutShape ) > > When I run that, I get this: > > # Traceback (most recent call last): > # File "C:/Documents and Settings/Jason Osipa/My Documents/ > Production/osipaEntertainment/omen/pyScratch/qWrapNode.py", line 116, > in compute > # data.outputValue( qWrapNode.aOutShape ).set( outMeshData ) > # File "C:\engserv\rbuild\194\build\wrk\optim\runTime\Python\Lib > \site-packages\maya\OpenMaya.py", line 8308, in <lambda> > # File "C:\engserv\rbuild\194\build\wrk\optim\runTime\Python\Lib > \site-packages\maya\OpenMaya.py", line 34, in _swig_getattr > # AttributeError: set // > > Help? I can't seem to find an example of or documentation on > "setting" mesh data anywhere. --~--~---------~--~----~------------~-------~--~----~ Yours, Maya-Python Club Team. -~----------~----~----~----~------~----~------~--~---