If the MObject passed from the data block is null when there is no connection/data present. MObject::isNull() might work for that.
Matt On Tue, Feb 17, 2009 at 10:29 AM, jasonosipa <[email protected]> wrote: > > 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... > > > > On Feb 16, 11:38 am, marcin <[email protected]> wrote: > > On 16 Lut, 19:00, Adam Mechtley <[email protected]> wrote: > > > > > HiMarcin, > > > > > Looks like you need to first iterate your mesh to store the normals in an > > > array, then iterate again to translate each point along these normals. > > > > It works perfect. Thanks :) > > I've one question about deform and compute methods in deformer class. > > I can access normals in compute and deform methods, so which one > > is better in this case ? > > > > Marcin > > --~--~---------~--~----~------------~-------~--~----~ Yours, Maya-Python Club Team. -~----------~----~----~----~------~----~------~--~---
