Is there a way to register a callback when the camera is changed? I tried registering a MNodeMessage::addAttributeChangedCallback for the camera node, but that didn't seem to get called when changing the view with (ALT-mouse button in the view windows). I've included the code leaving out the checks for error codes in the 'MStatus status' variable.
CODE
MStatus status;
MFnCamera camera;
M3dView curView = M3dView::active3dView(&status);
unsigned int numberOf3dViews = curView.numberOf3dViews();
if (numberOf3dViews > 0 ) {
MDagPath camDagPath;
status = curView.getCamera(camDagPath);
status = camera.setObject(camDagPath);
}
MObject camera_obj(camera.object(&status));
MNodeMessage::addAttributeChangedCallback( camera_obj, &camera_attribute_callback, NULL, &status);
CODE
void camera_attribute_callback( MNodeMessage::AttributeMessage msg,
MPlug& plug,
MPlug& otherPlug,
void* clientData)
{
string me("camera_attribute_callback");
cerr << me << " called\n";
}
I also tried addNodeDirtyCallback, but that didn't do anything either.
Thanks,
James