I have a Maya plugin and want to get events for timeChanges. However I need to pass a function that I don't want to be static, but this fail at compilation:
void MyClass::initializeCallbacks()
{
MDGMessage::addTimeChangeCallback((MMessage::MTimeFunction) &timeChanged,this);
}
void MyClass::timeChanged(MTime tim, MyClass* clientData)
{
<Code>
}
I then get the following compilation errors:
must explicitly qualify name of member function when taking its address
...&timeChanged,this);
^~~~~~~~~~~~
MyClass::
error: cannot cast from type 'void (MyClass::*)(MTime,
MyClass *)' to pointer type 'MMessage::MTimeFunction' (aka 'void
(*)(MTime &, void *)')
How can I properly pass a pointer of my function ?