MFnData.kMesh empty and MentalRay give error

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I Get the following Error:
I added a print command
PlugName = vehicleSamplerShape1.colliderMesh
// Error: file: C:/Program Files/Autodesk/mentalrayForMaya2014/scripts/AETemplates/AEmentalrayNewMessage.mel line 91: Cannot use data of type no type in a scalar operation. //
It Basically returns nothing while the plug is empty. The AETemplate doesn't accept this in the (Mel) If Statement.
In My plugin (Locator) I have a slot / plug for a mesh to collide against for ground collision (i'm firing rays against the mesh) But the plug isn't initialized when the node is created, as the user / interface is responsible for adding the mesh to collide against to the node. And it's a locator so I can use the OpenGL drawing fuctions to show the diameter, rays fired etc.. which I don't want to loose but I've been banging my head against this issue, and I can't find any instance of others coming across this.
Another "Issue" is that due to memory being utelized by the closest intersection function, I use an array of "Wheels" per node, to reduce the memory overhead when 100's of wheels with potentially 10-180 rays being fired per wheel. The error doesn't show up until you either 1 create the node, and again when you add wheels to it(the Array). It goes away when you actually connect something into the collisionMesh plug, but I don't want to create some bogus geo just for this issue. Another workaround was to un-load mentalRay, but again, that's not something I want to force the user to do.
The code used to get the plug created and not evaluate when it's empty is as follows (Python)
# Get The Mesh Data handle colliderMeshHandle = dataBlock.inputValue( self.colliderMeshAttr ) try : colliderMesh = OpenMaya.MFnMesh (colliderMeshHandle.asMesh()) except : return OpenMaya.kUnknownParameter