C++ API Reference
MPxDragAndDropBehavior Class Reference

Drag and Drop Behavior. More...

#include <MPxDragAndDropBehavior.h>

Public Member Functions

 MPxDragAndDropBehavior ()
 Class constructor.
 
virtual ~MPxDragAndDropBehavior ()
 Class destructor.
 
 MPxDragAndDropBehavior (void *init)
 This method is obsolete. More...
 
virtual bool shouldBeUsedFor (MObject &sourceNode, MObject &destinationNode, MPlug &sourcePlug, MPlug &destinationPlug)
 This method must be overridden in order to use a drag and drop behavior. More...
 
virtual MStatus connectAttrToAttr (MPlug &sourcePlug, MPlug &destinationPlug, bool force)
 This method is called by the defaultNavigation command to connect a source attribute to a destination attribute. More...
 
virtual MStatus connectAttrToNode (MPlug &sourcePlug, MObject &destinationNode, bool force)
 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. More...
 
virtual MStatus connectNodeToAttr (MObject &sourceNode, MPlug &destinationPlug, bool force)
 This method is called by the defaultNavigation command to connect a source node to a destination attribute. More...
 
virtual MStatus connectNodeToNode (MObject &sourceNode, MObject &destinationNode, bool force)
 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. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 

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:
hwPhongShader/hwPhongShaderBehavior.h, and slopeShader/slopeShaderBehavior.h.

Constructor & Destructor Documentation

MPxDragAndDropBehavior ( void *  init)

This method is obsolete.

Parameters
[in]init

Member Function Documentation

bool 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 then this routine must pass back true, otherwise the routine must pass back false in order for the default connection mechanism 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]sourceNodeThe source node of the drag and drop or the node being dragged
[in]destinationNodethe destination node of the drag and drop or the node being dropped upon
[in]sourcePlugThe source plug of the drag and drop or the plug being dragged (this may be null)
[in]destinationPlugThe destination plug of the drag and drop or the plug being dropped upon (this may be null)
Examples:
hwPhongShader/hwPhongShaderBehavior.h, and slopeShader/slopeShaderBehavior.h.
MStatus 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]sourcePlugSource plug in the connection
[in]destinationPlugDestination plug in the connection
[in]forceTells whether or not to break any existing connections to the destination attribute
Examples:
hwPhongShader/hwPhongShaderBehavior.h.
MStatus 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]sourcePlugSource plug for the connection
[in]destinationNodeDestination node for the connection
[in]forceTells whether or not to break any existing connections to the destination node
Examples:
hwPhongShader/hwPhongShaderBehavior.h.
MStatus 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]sourceNodeSource node for the connection
[in]destinationPlugDestination plug for the connection
[in]forceTells whether or not to break any existing connections to the destination attribute
Examples:
hwPhongShader/hwPhongShaderBehavior.h, and slopeShader/slopeShaderBehavior.h.
MStatus 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]sourceNodeSource node for the connection
[in]destinationNodeDestination node for the connection
[in]forceTells whether or not to break any existing connections to the destination node
Examples:
hwPhongShader/hwPhongShaderBehavior.h, and slopeShader/slopeShaderBehavior.h.
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.

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