Public Member Functions | Static Public Member Functions

MPxDragAndDropBehavior Class Reference

This reference page is linked to from the following overview topics: ハードウェア シェーディング ノード プラグインを実装する.


Search for all occurrences

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.

#include <MPxDragAndDropBehavior.h>

List of all members.

Public Member Functions

  MPxDragAndDropBehavior ()
  Class constructor.
virtual  ~MPxDragAndDropBehavior ()
  Class destructor.
  MPxDragAndDropBehavior (void *init)
  This method is obsolete.
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.
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.
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.
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.
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.

Static Public Member Functions

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

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 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:
hwPhongShaderBehavior.h, and 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] 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:
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] 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:
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] 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:
hwPhongShaderBehavior.h, and 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] 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:
hwPhongShaderBehavior.h, and slopeShaderBehavior.h.
const char * className ( ) [static]

Returns the name of this class.

Returns:
Name of this class.

MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior
MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior MPxDragAndDropBehavior