MPxDragAndDropBehavior Class Reference
[OpenMayaUI - API module for user interfaceProxy classes]

#include <MPxDragAndDropBehavior.h>

List of all members.


Detailed Description

Drag and Drop Behavior.

This is the base class for user defined drag and drop behaviors. This class allows a plugin to override the behavior of drag and drop connections from nodes in the hyperGraph/hyperShade to other nodes or other UI. These behaviors are defined by the type of relationship that is trying to be resolved. These are connectAttrToAttr(), connectAttrToNode(), connectNodeToAttr(), connectNodeToNode(). In order for the overridden methods to be executed the shouldBeUsedFor() method must be overridden in order to decide which behavior to use given the source and destination node.

Examples:

hwPhongShaderBehavior.h, and slopeShaderBehavior.h.


Public Member Functions

 MPxDragAndDropBehavior ()
virtual ~MPxDragAndDropBehavior ()
 MPxDragAndDropBehavior (void *init)
virtual bool shouldBeUsedFor (MObject &sourceNode, MObject &destinationNode, MPlug &sourcePlug, MPlug &destinationPlug)
virtual MStatus connectAttrToAttr (MPlug &sourcePlug, MPlug &destinationPlug, bool force)
virtual MStatus connectAttrToNode (MPlug &sourcePlug, MObject &destinationNode, bool force)
virtual MStatus connectNodeToAttr (MObject &sourceNode, MPlug &destinationPlug, bool force)
virtual MStatus connectNodeToNode (MObject &sourceNode, MObject &destinationNode, bool force)

Constructor & Destructor Documentation

MPxDragAndDropBehavior::MPxDragAndDropBehavior (  ) 

Class constructor.

MPxDragAndDropBehavior::~MPxDragAndDropBehavior (  )  [virtual]

Class destructor.

MPxDragAndDropBehavior::MPxDragAndDropBehavior ( void *  init  ) 

Class constructor.


Member Function Documentation

bool MPxDragAndDropBehavior::shouldBeUsedFor ( MObject sourceNode,
MObject destinationNode,
MPlug sourcePlug,
MPlug destinationPlug 
) [virtual]

This method must be overridden in order to use a drag and drop behavior. The overridden method will be called by the defaultNavigation command to determine wether or not to use this drag and drop behavior to finish a connection. If the user would like to handle the connection between sourceNode/Plug and destinationNode/Plug than this routine must pass back true, otherwise the routine must pass back false in order for the default connection mechinism to work between these two nodes. sourcePlug and destinationPlug may be null depending on if there were any attributes given in the drag and drop. Use the isNull() method on MPlug to assure the plugs are valid.

Parameters:
[in] sourceNode The source node of the drag and drop or the node being dragged
[in] destinationNode the destination node of the drag and drop or the node being dropped upon
[in] sourcePlug The source plug of the drag and drop or the plug being dragged (this may be null)
[in] destinationPlug The destination plug of the drag and drop or the plug being dropped upon (this may be null)
Examples:

MStatus MPxDragAndDropBehavior::connectAttrToAttr ( MPlug sourcePlug,
MPlug destinationPlug,
bool  force 
) [virtual]

This method is called by the defaultNavigation command to connect a source attribute to a destination attribute. If this method is overidden it should attempt to determine what the user probably wants this connection to be, and set up the connection appropriately. If the force argument is true it is intended to notify the user to break any existing connections to the plug, similar to what the mel command "connectAttr" -f flag is used for.

Parameters:
[in] sourcePlug Source plug in the connection
[in] destinationPlug Destination plug in the connection
[in] force Tells whether or not to break any existing connections to the destination attribute
Examples:

MStatus MPxDragAndDropBehavior::connectAttrToNode ( MPlug sourcePlug,
MObject destinationNode,
bool  force 
) [virtual]

This method is called by the defaultNavigation command to connect a source attribute to a destination node.You should override this method if you can determine from the type of source node and attribute and the type of destination node what the user is trying to do and you know the appropriate connections that must be made for the end result to be what the user expects.

Parameters:
[in] sourcePlug Source plug for the connection
[in] destinationNode Destination node for the connection
[in] force Tells whether or not to break any existing connections to the destination node
Examples:

MStatus MPxDragAndDropBehavior::connectNodeToAttr ( MObject sourceNode,
MPlug destinationPlug,
bool  force 
) [virtual]

This method is called by the defaultNavigation command to connect a source node to a destination attribute. You should override this method if you can determine from the type of source node and the type of destination node and attribute what the user is trying to do and you know the appropriate connections that must be made for the end result to be what the user expects.

Parameters:
[in] sourceNode Source node for the connection
[in] destinationPlug Destination plug for the connection
[in] force Tells whether or not to break any existing connections to the destination attribute
Examples:

MStatus MPxDragAndDropBehavior::connectNodeToNode ( MObject sourceNode,
MObject destinationNode,
bool  force 
) [virtual]

This method is called by the defaultNavigation command to connect a source node to a destination node.You should override this method if you can determine from the type of source node and the type of destination node what the user is trying to do and you know the appropriate connections that must be made for the end result to be what the user expects.

Parameters:
[in] sourceNode Source node for the connection
[in] destinationNode Destination node for the connection
[in] force Tells whether or not to break any existing connections to the destination node
Examples:


Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6