c++attributesmayadirty-data

Get MPxLocator to draw when attribute changes


I have a Maya/cpp code with an MPxLocator. This locator has an attribute called "Frame", and whenever the frame changes, I have a function that updates that attribute:

MFnDagNode myDagNode(MPxLocatorMObject);
myDagNode.findPlug("Frame").setValue(frame);

However the draw functions is not always started, only sometimes. How can I make the MPxLocator "dirty" when frame attribute is changed ?


Solution

  • Found out that the MPxLocator gets refreshed only if it is visible on screen (or at least the point representing its coordinates).