Hey guys! I'm new around here.

I'm currently trying to calculate some things when time changes, so I tried 
using the following method:

MCallbackId MDGMessage::addTimeChangeCallback(MMessage::MTimeFunction 
<http://download.autodesk.com/us/maya/2011help/API/class_m_message.html#5e33ef0b0eb43687c25b11606fad7194>
 *func, void * clientData = NULL, MStatus * ReturnStatus = NULL)*
However, it seems that the callback is called without the expected 
clientData, but with an MTime given instead. 
Am I doing something wrong?

Snippet: 


import maya.OpenMaya as OpenMaya


> def onTimeChangedCallback(*args):
> print "addTimeChangeCallback:" + str(list(args))
>     
> def addNodeAddedCallback(*args):
> print "addNodeAddedCallback:" + str(list(args))
>
> def addForceUpdateCallback(*args):
> print "addForceUpdateCallback:" + str(list(args))
>
> OpenMaya.MDGMessage.addTimeChangeCallback(onTimeChangedCallback, 
> "testStringTimeChanged")
> OpenMaya.MDGMessage.addForceUpdateCallback(addForceUpdateCallback, 
> "testStringForceUpdate")
> OpenMaya.MDGMessage.addNodeAddedCallback(addNodeAddedCallback, 
> "dependNode", "testStringAddNode")


The output, when moving the time slider:

addTimeChangeCallback:[<maya.OpenMaya.MTime; proxy of <Swig Object of type 
> 'MTime *' at 0x00000000355106C0> >, <maya.OpenMaya.MTime; proxy of <Swig 
> Object of type 'MTime *' at 0x00000000355106C0> >]
> addForceUpdateCallback:[<maya.OpenMaya.MTime; proxy of <Swig Object of 
> type 'MTime *' at 0x00000000355106C0> >, <maya.OpenMaya.MTime; proxy of 
> <Swig Object of type 'MTime *' at 0x00000000355106C0> >]


And when adding any node, just to be sure...

polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1; 
> objectMoveCommand;

addNodeAddedCallback:[<maya.OpenMaya.MObject; proxy of <Swig Object of type 
> 'MObject *' at 0x00000000355106C0> >, 'testStringAddNode']

addNodeAddedCallback:[<maya.OpenMaya.MObject; proxy of <Swig Object of type 
> 'MObject *' at 0x0000000035524360> >, 'testStringAddNode']

addNodeAddedCallback:[<maya.OpenMaya.MObject; proxy of <Swig Object of type 
> 'MObject *' at 0x0000000035524360> >, 'testStringAddNode']


This means that the addNodeAddedCallback is working correctly, receiving a 
test string, while the other two callbacks are just receiving MTime two 
times.
Is this a bug, or am I doing something wrong here?

Thanks!

-- 
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/39a47333-74e2-489d-846f-d3bd717409e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to