Hi All!
I actually took this code by Marcin, rejiggered it slightly to take in
a collider mesh, as well as a "maximum distance", just like the oeRay
plugin I put together, only this time, it's all a lot cleaner. There
is one kind of annoying problem, however, I'd love some help with,
which came up in both plug-ins: an empty collision plug making a lot
of noise.
I connect *anything* before the collision mesh, I get an error:
deformer -type myDeformer;
// Error: line 1: (kInvalidParameter): Argument is a NULL pointer
# Traceback (most recent call last):
# File "C:/myDeformer.py", line 28, in compute
# targetFnMesh = om.MFnMesh( targetMesh )
# File "C:\engserv\rbuild\194\build\wrk\optim\runTime\Python\Lib
\site-packages\maya\OpenMaya.py", line 4281, in __init__
# RuntimeError: (kInvalidParameter): Argument is a NULL pointer //
// Error: line 1: Connection not made: 'pSphereShape1.instObjGroups
[0]' -> 'set2.dagSetMembers[-1]'. Destination node will not allow the
connection. //
// Error: line 1: Connection not made: 'pSphereShape1.instObjGroups
[0]' -> 'set2.dagSetMembers[-1]'. Destination node will not allow the
connection. //
// Result: myDeformer1 //
As soon as I hook up a collision mesh, everything works perfectly,
errors all go away, the deformed mesh does what's expected. So, is
there a way inside of the compute to simply check if the collision
plug is occupied? Would that be the same for a single connection v an
array, or different?
From that check it would just be a simple "if" and I could just skip
the collision stuff...