Hi,
I’m confused by the MSceneMessage.addConnectionFailedCallback behaviour...
Basically I try to create a callback for monitoring failed connections during
reopening of a file containing references...
Here is the code snippet for repro:
MSceneMessage addConnectionFailedCallbackimport maya.OpenMaya as omimport 
maya.cmds as cmdsimport ostmpDir = os.environ["TMPDIR"]# Create basic scene to 
be referencedcmds.file(new=True, f=True)locScene = cmds.file(rename="%s/loc.ma" 
%tmpDir)cmds.spaceLocator()cmds.file(save=True, f=True, type="mayaAscii")# 
Create master scene to reference loccmds.file(new=True, 
f=True)cmds.file(locScene, r=True, 
namespace="REF")cmds.setKeyframe('REF:locator1')masterScene = 
cmds.file(rename="%s/master.ma" %tmpDir)cmds.file(save=True, f=True, 
type="mayaAscii")# Reopen loc scene, lock an attr and savecmds.file(locScene, 
f=True, o=True)cmds.setAttr("locator1.tx", l=True)cmds.file(save=True, f=True)# 
Create callBackdef cb(srcPlug,destPlug,srcPlugName,dstPlugName,clientData):    
print "callback triggered"    print srcPlug    print destPlug    print 
srcPlugName    print dstPlugName    print clientDatacb_id = 
om.MSceneMessage.addConnectionFailedCallback(cb, "noData")# Reopening master 
scene, shouldn't callback trigger??cmds.file(masterScene, f=True, o=True)#To 
kill the callBack#om.MMessage.removeCallback(cb_id)

Not using Mixmax yet?
Maybe I don’t get it right, because the callback is not triggered in this
scenario.
To investigate, I tried to insert directly some code into the masterScene ma: 
connectAttr “aFake.plug” “REF:locator1.tx”;
saving and reopening, and then the callback is executed: callback triggered 
<maya.OpenMaya.MPlug; proxy of <Swig Object of type 'MPlug *' at 0x7d51c90> > 
<maya.OpenMaya.MPlug; proxy of <Swig Object of type 'MPlug *' at 0x7d51ba0> > 
this.plug REF.tx noData
So it must be that failing connections on a reference node placeHolder is not
caught by the callback. But as we can see in the details printed by the 
callback, dstPlugName seems
incorrect.
Has anyone used this callback in this scenario? Didn’t find much infos on 
google…
Any hint/suggestions would be very welcome.
Nicolas

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/1434754669547-9ef55ec0-33bcdda0-ea8e1c12%40mixmax.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to