C++ API Reference
MPxManipulatorNode Class Reference

Base class for manipulator creation. More...

#include <MPxManipulatorNode.h>

+ Inheritance diagram for MPxManipulatorNode:

Public Member Functions

 MPxManipulatorNode ()
 Class constructor.
 
 ~MPxManipulatorNode () override
 Class destructor.
 
virtual MStatus connectToDependNode (const MObject &dependNode)
 This method connects the manipulator to the dependency node. More...
 
virtual void preDrawUI (const M3dView &view)
 This method is not available in Python. More...
 
virtual void drawUI (MHWRender::MUIDrawManager &drawManager, const MHWRender::MFrameContext &frameContext) const
 This method is not available in Python. More...
 
virtual void draw (M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status)
 This method is overloaded to draw the manipulators. More...
 
virtual MStatus doPress (M3dView &view)
 This method gets called when the manipulator receives a mouse down event. More...
 
virtual MStatus doDrag (M3dView &view)
 This method gets called when the manipulator receives a mouse drag event. More...
 
virtual MStatus doRelease (M3dView &view)
 This method gets called when the manipulator receives a mouse release event. More...
 
virtual MStatus doMove (M3dView &view, bool &refresh)
 This method gets called when the manipulator receives a mouse move event, if the manipulator registered for mouse move events. More...
 
MStatus finishAddingManips ()
 This method should be called from the user-defined manipulator plug-in near the end of the connectToDependNode method so that the converter in the manipulator can be initialized. More...
 
MStatus colorAndName (M3dView &view, MGLuint glName, bool glNameIsPickable, short colorIndex) const
 This method is used to set the color of the GL component that is being drawn next. More...
 
MStatus shouldDrawHandleAsSelected (unsigned int name, bool &useSelectedColor) const
 This method is obsolete. More...
 
MStatus setHandleColor (MHWRender::MUIDrawManager &drawManager, unsigned int handleName, short colorIndex) const
 This method is used to set the color of component that is being drawn next. More...
 
MStatus glFirstHandle (MGLuint &firstHandle)
 This method is used to find the unsigned int value that should be used for the first GL handle. More...
 
MStatus glActiveName (MGLuint &glName)
 This method returns the unsigned int value which specifies the current active handle. More...
 
MStatus mouseRay (MPoint &linePoint, MVector &lineDirection) const
 This method returns the location of the mouse within a view. More...
 
MStatus mouseRayWorld (MPoint &linePoint, MVector &lineDirection) const
 This method returns the location of the mouse within a view. More...
 
MStatus mousePosition (short &x_pos, short &y_pos)
 This method returns the current mouse position within a view. More...
 
MStatus mouseDown (short &x_pos, short &y_pos)
 This method returns the mouse down position within a view. More...
 
MStatus mouseUp (short &x_pos, short &y_pos)
 This method returns the mouse up position within a view. More...
 
MStatus registerForMouseMove ()
 This method registers this manipulator to receive mouse move events. More...
 
MStatus deregisterForMouseMove ()
 This method deregisters this manipulator from receiving mouse move events. More...
 
MStatus addDoubleValue (const MString &valueName, double defaultValue, int &valueIndex)
 Manipulators which call connectPlugToValue() must first create the value on the node. More...
 
MStatus addPointValue (const MString &valueName, const MPoint &defaultValue, int &valueIndex)
 Manipulators which call connectPlugToValue() must first create the value on the node. More...
 
MStatus addVectorValue (const MString &valueName, const MVector &defaultValue, int &valueIndex)
 Manipulators which call connectPlugToValue() must first create the value on the node. More...
 
MStatus setDoubleValue (int valueIndex, double value)
 This method is used for setting a double value associated with the manipulator. More...
 
MStatus setPointValue (int valueIndex, const MPoint &value)
 This method is used for setting an MPoint value associated with the manipulator. More...
 
MStatus setVectorValue (int valueIndex, const MVector &value)
 This method is used for setting a MVector value associated with the manipulator. More...
 
MStatus getDoubleValue (int valueIndex, bool previousValue, double &value)
 This method is used for getting a double value associated with the manipulator. More...
 
MStatus getPointValue (int valueIndex, bool previousValue, MPoint &value)
 This method is used for getting a MPoint value associated with the manipulator. More...
 
MStatus getVectorValue (int valueIndex, bool previousValue, MVector &value)
 This method is used for getting a MVector value associated with the manipulator. More...
 
MStatus connectPlugToValue (const MPlug &plug, int valueIndex, int &plugIndex)
 This method is called in the connectToDependNode() virtual if it is implemented for the custom manipulator. More...
 
MStatus addDependentPlug (const MPlug &plug)
 This method adds the plug to the list of those to be keyframed. More...
 
MStatus dependentPlugsReset ()
 This method resets the list of dependent plugs for this manipulator. More...
 
short mainColor () const
 This method returns the main color index.
 
short xColor () const
 This method returns the color index of the x axis.
 
short yColor () const
 This method returns the color index of the y axis.
 
short zColor () const
 This method returns the color index of the z axis.
 
short prevColor () const
 This method returns the previously color used by the colorAndName() method.
 
short lineColor () const
 This method returns the color index of a line.
 
short dimmedColor () const
 This method returns the color index for a dimmed or unselectable component.
 
short selectedColor () const
 This method returns the color index of a selected component.
 
short labelColor () const
 This method returns the color index of a label.
 
short labelBackgroundColor () const
 This method returns the color index of a label background.
 
- Public Member Functions inherited from MPxNode
 MPxNode ()
 Constructor. More...
 
virtual ~MPxNode ()
 Destructor.
 
virtual void postConstructor ()
 Post constructor. More...
 
virtual MStatus compute (const MPlug &, MDataBlock &)
 This method should be overridden in user defined nodes. More...
 
virtual bool getInternalValue (const MPlug &, MDataHandle &)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual bool setInternalValue (const MPlug &, const MDataHandle &)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual int internalArrayCount (const MPlug &) const
 This method is overridden by nodes that have internal array attributes which are not stored in Maya's datablock. More...
 
virtual void copyInternalData (MPxNode *)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual MStatus legalConnection (const MPlug &, const MPlug &, bool asSrc, bool &isLegal) const
 This method allows you to check for legal connections being made to attributes of this node. More...
 
virtual MStatus legalDisconnection (const MPlug &, const MPlug &, bool asSrc, bool &isLegal) const
 This method allows you to check for legal disconnections being made to attributes of this node. More...
 
virtual MStatus setDependentsDirty (const MPlug &plug, MPlugArray &plugArray)
 This method can be overridden in user defined nodes to specify which plugs should be set dirty based upon an input plug {plugBeingDirtied} which Maya is marking dirty. More...
 
virtual MStatus preEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode)
 Prepare a node's internal state for threaded evaluation. More...
 
virtual MStatus postEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode, PostEvaluationType evalType)
 Clean up node's internal state after threaded evaluation. More...
 
virtual SchedulingType schedulingType () const
 When overridden this method controls the degree of parallelism supported by the node during threaded evaluation. More...
 
virtual void getCacheSetup (const MEvaluationNode &, MNodeCacheDisablingInfo &, MNodeCacheSetupInfo &, MObjectArray &) const
 Provide node-specific setup info for the Cached Playback system. More...
 
virtual void configCache (const MEvaluationNode &, MCacheSchema &) const
 Defines the node's behavior when participating in Cached Playback. More...
 
virtual MTimeRange transformInvalidationRange (const MPlug &source, const MTimeRange &input) const
 Override this method to register this node as an Invalidation-Range-Transformation kernel (IRT kernel) An IRT kernel node will change the invalidation time range for its downstream nodes For example, Dynamics-solver will transform invalidation time range [a,b] to [a,+inf) And Clip-Time-Editor will send out the invalidation range for each of the clip [a,b] to ( [t0+a,t0+b] U [t1+a,t1+b] U [t2+a,t2+b] U ... More...
 
bool hasInvalidationRangeTransformation () const
 Checks if this MPxNode derived node overrides the MPxNode::transformInvalidationRange method.
 
virtual MStatus connectionMade (const MPlug &, const MPlug &, bool asSrc)
 This method gets called when connections are made to attributes of this node. More...
 
virtual MStatus connectionBroken (const MPlug &, const MPlug &, bool asSrc)
 This method gets called when connections are broken with attributes of this node. More...
 
virtual MStatus dependsOn (const MPlug &, const MPlug &, bool &depends) const
 This method may be overridden by the user defined node. More...
 
virtual bool isPassiveOutput (const MPlug &) const
 This method may be overridden by the user defined node if it wants to provide output attributes which do not prevent value modifications to the destination attribute. More...
 
virtual MStatus shouldSave (const MPlug &, bool &isSaving)
 This method may be overridden by the user defined node. More...
 
virtual MPlug passThroughToOne (const MPlug &) const
 This method may be overridden by nodes that have a one-to-one relationship between an input attribute and a corresponding output attribute. More...
 
virtual bool passThroughToMany (const MPlug &, MPlugArray &) const
 This method is overridden by nodes that want to control the traversal behavior of some Maya search algorithms which traverse the history/future of shape nodes looking for directly related nodes. More...
 
virtual Type type () const
 Returns the type of node that this is. More...
 
virtual bool isAbstractClass () const
 Override this class to return true if this node is an abstract node. More...
 
virtual bool isTrackingTopology () const
 Override this class to return true if this node wants to track topology. More...
 
virtual MStringArray getFilesToArchive (bool shortName=false, bool unresolvedName=false, bool markCouldBeImageSequence=false) const
 Use this method to return all external files used by this node. More...
 
virtual void getExternalContent (MExternalContentInfoTable &table) const
 Returns the external content (files) that this node depends on. More...
 
bool addExternalContentForFileAttr (MExternalContentInfoTable &, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
bool setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &)
 Sets content info in the specified attribute from the table. More...
 
virtual void setExternalContent (const MExternalContentLocationTable &)
 Changes the location of external content in batch. More...
 
virtual MTypeId typeId () const
 Returns the TYPEID of this node. More...
 
virtual MString typeName () const
 Returns the type name of this node. More...
 
virtual MString name () const
 Returns the name of this particular instance of this class. More...
 
virtual MObject thisMObject () const
 Returns the MObject associated with this user defined node. More...
 
virtual MStatus setExistWithoutInConnections (bool flag)
 This method specifies whether or not the node can exist without input connections. More...
 
virtual bool existWithoutInConnections (MStatus *ReturnStatus=NULL) const
 Determines whether or not this node can exist without input connections. More...
 
virtual MStatus setExistWithoutOutConnections (bool flag)
 This method specifies whether or not the node can exist without output connections. More...
 
virtual bool existWithoutOutConnections (MStatus *ReturnStatus=NULL) const
 Determines whether or not this node can exist without output connections. More...
 
void _setMPSafe (bool isMPSafe)
 This method is obsolete. More...
 
MDataBlock _forceCache (const MDGContext &)
 This method is obsolete. More...
 
virtual bool getInternalValueInContext (const MPlug &, MDataHandle &, MDGContext &)
 This method is obsolete. More...
 
virtual bool setInternalValueInContext (const MPlug &, const MDataHandle &, MDGContext &)
 This method is obsolete. More...
 
virtual int internalArrayCount (const MPlug &, const MDGContext &) const
 This method is obsolete. More...
 

Static Public Member Functions

static MPxManipulatorNodenewManipulator (const MString &manipName, MObject &manipObject, MStatus *ReturnStatus=NULL)
 This static function is used to create a user-defined manipulator. More...
 
static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MPxNode
static MStatus addAttribute (const MObject &attr)
 This method adds a new attribute to a user defined node type during the type's initialization. More...
 
static MStatus inheritAttributesFrom (const MString &parentClassName)
 This method allows a class of plugin node to inherit all of the attributes of a second class of plugin node. More...
 
static MStatus attributeAffects (const MObject &whenChanges, const MObject &isAffected)
 This method specifies that a particular input attribute affects a specific output attribute. More...
 
static MStatus attributeAffects (const MObject &whenChanges, const MObject &isAffected, bool affectsTopology)
 This method is an extension to the other version of the attributeAffects method. More...
 
static const char * className ()
 Returns the name of this class. More...
 

Static Public Attributes

static MObject connectedNodes
 Connected node, message attribute.
 
- Static Public Attributes inherited from MPxNode
static MObject message
 message attribute
 
static MObject isHistoricallyInteresting
 is historically interesting attribute
 
static MObject caching
 caching attribute
 
static MObject state
 state attribute
 
static MObject frozen
 frozen attribute
 

Additional Inherited Members

- Public Types inherited from MPxNode
enum  Type {
  kDependNode, kLocatorNode, kDeformerNode, kManipContainer,
  kSurfaceShape, kFieldNode, kEmitterNode, kSpringNode,
  kIkSolverNode, kHardwareShader, kHwShaderNode, kTransformNode,
  kObjectSet, kFluidEmitterNode, kImagePlaneNode, kParticleAttributeMapperNode,
  kCameraSetNode, kConstraintNode, kManipulatorNode, kMotionPathNode,
  kClientDeviceNode, kThreadedDeviceNode, kAssembly, kSkinCluster,
  kGeometryFilter, kBlendShape, kLast
}
 Defines the type of node. More...
 
enum  SchedulingType {
  kParallel, kSerial, kGloballySerial, kUntrusted ,
  kDefaultScheduling = kSerial, kSerialize = kSerial, kGloballySerialize = kGloballySerial
}
 Defines the degree of parallelism of a node. More...
 
- Protected Member Functions inherited from MPxNode
virtual MDataBlock forceCache ()
 USE _forceCache() IN SCRIPT. More...
 
virtual MStatus setDoNotWrite (bool flag)
 USE _setDoNotWrite() IN SCRIPT. More...
 
virtual bool doNotWrite (MStatus *ReturnStatus=NULL) const
 USE _doNotWrite() IN SCRIPT. More...
 
virtual void setMPSafe (bool isMPSafe)
 This method is obsolete. More...
 
virtual MDataBlock forceCache (const MDGContext &)
 This method is obsolete. More...
 

Detailed Description

Base class for manipulator creation.

MPxManipulatorNode is the base class used for creating user-defined manipulators. This class is derived from MPxNode since manipulators in Maya are dependency nodes.

An MPxManipulatorNode should implement the following method:

virtual void draw(M3dView &view, const MDagPath &path,M3dView::DisplayStyle style, M3dView::DisplayStatus status);

Additionally, several of the following virtuals will need to be defined:

virtual MStatus doPress( M3dView& view );
virtual MStatus doDrag( M3dView& view );
virtual MStatus doRelease( M3dView& view );

Implement the following method to properly support undo:

virtual MStatus connectToDependNode(const MObject &dependNode);

The draw() method is very important since drawing and picking are done together. The colorAndName() method should be called before drawing a GL component that should be pickable. Several color methods which return color indexes that Maya use are provided to allow custom manipulators to have a similar look.

When drawing a GL pickable component, an active name must be set. Use the glFirstHandle() to get this value from the base class.

To draw the manipulator in Viewport 2.0, the plugin must also implement preDrawUI() and drawUI(). Note that selection relies on the default viewport draw pass so the draw() method must still be implemented even if the manipulator is not intended for use in the default viewport. preDrawUI() is called before drawUI() and should be used to prepare and cache data which will be needed to draw the manipulator in drawUI().

A manipulator can be connected to a depend node instead of updating a node attribute directly in one of the do*() methods. To connect to a depend node, you must:

This class can work standalone or with MPxManipContainer.

Examples:
lineManip/lineManip.h, lineManipContainer/lineManipContainer.cpp, lineManipContainer/lineManipContainer.h, pointManip/pointManip.h, squareScaleManip/squareScaleManip.cpp, squareScaleManip/squareScaleManip.h, squareScaleManipContext/squareScaleManipContext.cpp, and squareScaleManipContext/squareScaleManipContext.h.

Member Function Documentation

MStatus connectToDependNode ( const MObject node)
virtual

This method connects the manipulator to the dependency node.

This is a virtual method and needs to be overridden from the plug-in.

Parameters
[in]nodethe node to which the manipulator should be connected
Returns
  • MS::kSuccess Operation successful
  • MS::kFailure If there are no connections between manipulator values and plug values
Examples:
squareScaleManipContext/squareScaleManipContext.h.
void preDrawUI ( const M3dView view)
virtual

This method is not available in Python.

This method is used to setup some drawing data for drawing the manipulator in Viewport 2.0 .

The data updated and cached in this function will be used later during 'drawUI()'.

This method is only called when the manipulator needs to be drawn in Viewport 2.0.

This method need only be overridden if custom data is needed for drawing in drawUI(). If no such data is needed, this method may be left unimplemented.

This function is empty in this base class.

Parameters
[in]viewThe view in which to draw
Examples:
lineManip/lineManip.h, lineManipContainer/lineManipContainer.h, pointManip/pointManip.h, squareScaleManip/squareScaleManip.h, and squareScaleManipContext/squareScaleManipContext.h.
void drawUI ( MHWRender::MUIDrawManager drawManager,
const MHWRender::MFrameContext frameContext 
) const
virtual

This method is not available in Python.

This is the primary method for drawing the manipulator in Viewport 2.0.

All drawing should occur using the MUIDrawManager and any data cached in preDrawUI(). Raw OpenGL calls are not supported and if used behaviour will be undefined. Selection must still be handled in the draw() method, this method is only for display.

This method is only called when the manipulator needs to be drawn in Viewport 2.0.

This function is empty in this base class.

Parameters
[in]drawManagerThe MUIDrawManager used to draw some simple UI
[in]frameContextFrame level context information
Examples:
lineManip/lineManip.h, lineManipContainer/lineManipContainer.h, pointManip/pointManip.h, squareScaleManip/squareScaleManip.h, and squareScaleManipContext/squareScaleManipContext.h.
void draw ( M3dView view,
const MDagPath path,
M3dView::DisplayStyle  style,
M3dView::DisplayStatus  status 
)
virtual

This method is overloaded to draw the manipulators.

Selection is also setup with this method using the colorAndName() method call.

// Begin the drawing
view.beginGL();
// Place before you draw the manipulator component that can
// be pickable.
MGLuint glPickableItem;
glFirstHandle( glPickableItem );
// Top
topName = glPickableItem;
colorAndName( view, glPickableItem, true, mainColor() );
gGLFT->glBegin( GL_LINES );
gGLFT->glVertex3fv( tl );
gGLFT->glVertex3fv( tr );
gGLFT->glEnd();
// Right
glPickableItem++;
rightName = glPickableItem;
colorAndName( view, glPickableItem, true, mainColor() );
gGLFT->glBegin( GL_LINES );
gGLFT->glVertex3fv( tr );
gGLFT->glVertex3fv( br );
gGLFT->glEnd();
// ...
// End the drawing
view.endGL();

This function is empty in this base class.

Parameters
[in]viewthe view in which to draw
[in]paththe current path
[in]stylethe display appearance
[in]statusthe display status
MStatus doPress ( M3dView view)
virtual

This method gets called when the manipulator receives a mouse down event.

You should return kUnknownParameter to allow Maya to process the event also.

Parameters
[in]viewthe view that is active
Returns
  • MS::kSuccess Operation successful
  • MS::kUnknownParameter Allow Maya to process event
Examples:
lineManip/lineManip.h, lineManipContainer/lineManipContainer.h, pointManip/pointManip.h, squareScaleManip/squareScaleManip.h, and squareScaleManipContext/squareScaleManipContext.h.
MStatus doDrag ( M3dView view)
virtual

This method gets called when the manipulator receives a mouse drag event.

You should return kUnknownParameter to allow Maya to process the event also.

Parameters
[in]viewthe view that is active
Returns
  • MS::kSuccess Operation successful
  • MS::kUnknownParameter Allow Maya to process event
Examples:
lineManip/lineManip.h, lineManipContainer/lineManipContainer.h, pointManip/pointManip.h, squareScaleManip/squareScaleManip.h, and squareScaleManipContext/squareScaleManipContext.h.
MStatus doRelease ( M3dView view)
virtual

This method gets called when the manipulator receives a mouse release event.

You should return kUnknownParameter to allow Maya to process the event also.

Parameters
[in]viewthe view that is active
Returns
  • MS::kSuccess Operation successful
  • MS::kUnknownParameter Allow Maya to process event
Examples:
lineManip/lineManip.h, lineManipContainer/lineManipContainer.h, pointManip/pointManip.h, squareScaleManip/squareScaleManip.h, and squareScaleManipContext/squareScaleManipContext.h.
MStatus doMove ( M3dView view,
bool &  refresh 
)
virtual

This method gets called when the manipulator receives a mouse move event, if the manipulator registered for mouse move events.

To register for mouse move events, invoke registerForMouseMove() in the postConstructor of your manipulator.

You should return kUnknownParameter to allow Maya to process the event also.

Parameters
[in]viewthe view that is active
[out]refreshif true, refresh the view on this event. Default is false.
Returns
  • MS::kSuccess Operation successful
  • MS::kUnknownParameter Allow Maya to process event
MStatus finishAddingManips ( )

This method should be called from the user-defined manipulator plug-in near the end of the connectToDependNode method so that the converter in the manipulator can be initialized.

The converter cannot be initialized until all the connections from the manip values to the plug values have been specified.

Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus colorAndName ( M3dView view,
MGLuint  glName,
bool  glNameIsPickable,
short  colorIndex 
) const

This method is used to set the color of the GL component that is being drawn next.

It is also used to set GL name of the component so that picking can be supported.

Parameters
[in]viewthe view that is active
[in]glNameGL "name" (an unsigned int) of the component. Must be unique.
[in]glNameIsPickableIf true, the component will be pickable
[in]colorIndexColor to use, as provided by one of the *Color() methods in this class.
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus shouldDrawHandleAsSelected ( unsigned int  name,
bool &  useSelectedColor 
) const

This method is obsolete.

This method can be used to find out if the handle should be drawn using the selected color instead of the regular one.

[as of Maya 2019]

Deprecated:
This function is obsolete, please use 'setHandleColor' instead
Parameters
[in]nameunique name (an unsigned int) of the component.
[out]useSelectedColorwill be true if the handle is active or highlighted.
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus setHandleColor ( MHWRender::MUIDrawManager drawManager,
unsigned int  handleName,
short  colorIndex 
) const

This method is used to set the color of component that is being drawn next.

The color will be correctly selected based on the component's state(highlighted, selected, etc.)

Parameters
[in]drawManagerThe MUIDrawManager used to draw some simple UI.
[in]handleNameThe unique name (an unsigned int) of the component.
[in]colorIndexThe default color, if the component is neither highlighted nor selected, the colorIndex will be used.
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus glFirstHandle ( MGLuint &  firstHandle)

This method is used to find the unsigned int value that should be used for the first GL handle.

Parameters
[out]firstHandleReturns the first handle.
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus glActiveName ( MGLuint &  glName)

This method returns the unsigned int value which specifies the current active handle.

Parameters
[out]glNameactive handle
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus mouseRay ( MPoint linePoint,
MVector lineDirection 
) const

This method returns the location of the mouse within a view.

The location is defined by a point and a direction through the point. Both point and direction are in local space.

Parameters
[out]linePointlocal space line point of mouse
[out]lineDirectionlocal direction of mouse in view
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus mouseRayWorld ( MPoint linePoint,
MVector lineDirection 
) const

This method returns the location of the mouse within a view.

The location is defined by a point and a direction through the point. Both point and direction are in world space.

Parameters
[out]linePointworld space line point of mouse
[out]lineDirectionworld direction of mouse in view
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus mousePosition ( short &  x_pos,
short &  y_pos 
)

This method returns the current mouse position within a view.

The position is in port coordinates.

Parameters
[out]x_posreturns the x port coordinate
[out]y_posreturns the y port coordinate
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus mouseDown ( short &  x_pos,
short &  y_pos 
)

This method returns the mouse down position within a view.

The position is in port coordinates.

Parameters
[out]x_posreturns the mouse down x port coordinate
[out]y_posreturns the mouse down y port coordinate
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus mouseUp ( short &  x_pos,
short &  y_pos 
)

This method returns the mouse up position within a view.

The position is in port coordinates.

Parameters
[out]x_posreturns the mouse up x port coordinate
[out]y_posreturns the mouse up y port coordinate
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus registerForMouseMove ( )

This method registers this manipulator to receive mouse move events.

When registered, the doMove() function will be invoked on mouse move events.

Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus deregisterForMouseMove ( )

This method deregisters this manipulator from receiving mouse move events.

Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus addDoubleValue ( const MString valueName,
double  defaultValue,
int &  valueIndex 
)

Manipulators which call connectPlugToValue() must first create the value on the node.

Use this method to create a value of double type.

Parameters
[in]valueNameName of the value.
[in]defaultValueDefault value.
[out]valueIndexIndex assigned to this value by Maya. Used in connectPlugToValue().
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus addPointValue ( const MString valueName,
const MPoint defaultValue,
int &  valueIndex 
)

Manipulators which call connectPlugToValue() must first create the value on the node.

Use this method to create a value of double MPoint.

Parameters
[in]valueNameName of the value.
[in]defaultValueDefault value.
[out]valueIndexIndex assigned to this value by Maya. Used in connectPlugToValue().
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus addVectorValue ( const MString valueName,
const MVector defaultValue,
int &  valueIndex 
)

Manipulators which call connectPlugToValue() must first create the value on the node.

Use this method to create a value of double MVector.

Parameters
[in]valueNameName of the value.
[in]defaultValueDefault value.
[out]valueIndexIndex assigned to this value by Maya. Used in connectPlugToValue().
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus setDoubleValue ( int  valueIndex,
double  value 
)

This method is used for setting a double value associated with the manipulator.

Parameters
[in]valueIndexthe index of the value to be set
[in]valuethe value to set it to
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus setPointValue ( int  valueIndex,
const MPoint value 
)

This method is used for setting an MPoint value associated with the manipulator.

Parameters
[in]valueIndexthe index of the value to be set
[in]valuethe value to set it to
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus setVectorValue ( int  valueIndex,
const MVector value 
)

This method is used for setting a MVector value associated with the manipulator.

Parameters
[in]valueIndexthe index of the value to be set
[in]valuethe value to set it to
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus getDoubleValue ( int  valueIndex,
bool  previousValue,
double &  value 
)

This method is used for getting a double value associated with the manipulator.

Parameters
[in]valueIndexthe index of the value to be set
[in]previousValueif true, get the previous value. if false, get the current value
[out]valuereturn the double value
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus getPointValue ( int  valueIndex,
bool  previousValue,
MPoint value 
)

This method is used for getting a MPoint value associated with the manipulator.

Parameters
[in]valueIndexthe index of the value to be set
[in]previousValueif true, get the previous value. if false, get the current value
[out]valuereturn the double value
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus getVectorValue ( int  valueIndex,
bool  previousValue,
MVector value 
)

This method is used for getting a MVector value associated with the manipulator.

Parameters
[in]valueIndexthe index of the value to be set
[in]previousValueif true, get the previous value. if false, get the current value
[out]valuereturn the double value
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MStatus connectPlugToValue ( const MPlug plug,
int  valueIndex,
int &  plugIndex 
)

This method is called in the connectToDependNode() virtual if it is implemented for the custom manipulator.

It will connect a plug to an already added manipulator value of the same type.

Parameters
[in]plugthe plug to connect the value to
[in]valueIndexthe index of the value. index is set by add*Value() method
[out]plugIndexa new index for the plug that is being connected
Returns
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
MPxManipulatorNode * newManipulator ( const MString manipName,
MObject manipObject,
MStatus ReturnStatus = NULL 
)
static

This static function is used to create a user-defined manipulator.

The manipObject argument is set to the new manipulator node. Note that the manipName argument must be the name of a manipulator derived from MPxManipulatorNode. Also note that this method creates the newManipulator, but doesn't add it to the DAG. The primary use of this method is in conjunction with MPxSelectionContext::addManipulator, to add user-defined manipulators to a context.

Parameters
[in]manipNamemanipulator name
[out]manipObjectmanipulator object
[out]ReturnStatusStatus code.
Returns
The new manipulator
MStatus addDependentPlug ( const MPlug plug)

This method adds the plug to the list of those to be keyframed.

The call to addDependentPlug() should happen prior to the manipulator identifying the plugs to be set. For example, if your manipulator sets plugs based on the selection list or modifier keys you could call addDependentPlug() from your doPress() method. Note that the dependentPlugsReset() method is provided to clear out the list and should be called prior to addDependentPlugs().

Parameters
[in]plugthe plug to keyframe when using this manipulator
Returns
  • MS::kSuccess Operation successful
  • MS::kFailure Invalid object
MStatus dependentPlugsReset ( )

This method resets the list of dependent plugs for this manipulator.

Call this method prior to adding plugs via addDependentPlug() such as from your doPress() method.

Returns
  • MS::kSuccess Operation successful
  • MS::kFailure Invalid object
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files: