hey mike,

thanks for the thoughts: i have to admit to (almost) complete
ignorance when it comes to maya API stuff, so i'm flying a little
blind here. and i know next to nothing about c++...

here's some code from my crash-setup:

def prePlugDetected(self, src, dest, connectType, clientData ):

    sourcePlug = src.name()
    destPlug = dest.name()

    print '-------'
    print src.name()
    print ['disconnected from', 'connected to'][connectType]
    print destPlug
    print '-------'

    return True

OpenMaya.MDGMessage.addPreConnectionCallback( prePlugDetected, None )

curiously, i have no problem with the "addConnectionCallback" - i can
pass an identical function to it and all is happy. but the "pre"
version crashes hard. this makes me suspect it may be buggy.

i've been passing None into *clientData, but i've tried a few
different things there, all to no avail.

thanks for your help,
chrisg


On 3 August 2011 04:09, notanymike <[email protected]> wrote:
> What are you overloading the *clientData part of the function with?
> I'm not sure how it works in python, but I had a similar problem with
> creating
> a MNodeMessage::addNodeDirtyCallback in c++. I had my function wanting
> to access a pointer
> to my node but had not overloaded the callback with that pointer. Most
> examples put NULL into
> the *clientData, however you might need to input "this" or "self," I
> guess. You might also or otherwise need to
> overload the MPlugFunction function itself like this maybe:
> def myfunction(OpenMaya.MMessage.MPlugFunction(srcPlg,destPlg,True(or
> False),self))
> That is just my guess. Overall it might be preferable to use c++ for
> callback functions
> since it's easier to see where everything needs to go....

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to