Maya API How-To #06 | ||
| ||
How do I "constrain" my custom manipulator to the position of another manipulator within the same MPxManipContainer?For the first manipulator (the one you want to "follow"), perform the steps outlined in How do I "constrain" my custom manipulator so it moves with its parent node? Add the following:
void wanderPointManip::draw(M3dView & view,
const MDagPath & path,
M3dView::DisplayStyle style,
M3dView::DisplayStatus status)
{
// ...
// Get the index to the CurrentPoint of the manipulator you want to follow
unsigned currentPointIndex = leaderManipFn.currentPointIndex( &mstat );
// Create a MPoint object to hold the coordinates of the CurrentPoint
MPoint currentPoint;
getConverterManipValue( currentPointIndex, currentPoint );
// Set the "follower" manipulator's StartPoint to the "leader" manipulator's CurrentPoint
followerManipFn.setStartPoint( currentPoint );
// ...
// Do the above _before_ calling the parent 'draw' function to ensure
// that the manip generates the desired results without needing to be "refreshed"
MPxManipContainer::draw(view, path, style, status);
}
Stir, and enjoy. Related How-To's | ||
| Copyright ©2005 by Bryan Ewert, maya@ewertb.com Maya is a Registered Trademark of Alias |