MFnPluginData Class Reference

#include <MFnPluginData.h>

Class Description

User defined data function set for dependency node data.

All user defined data that is to be passed between nodes in the dependency graph must be derived from MPxData. The use of this class is closely linked to the use of MPxData, MFnPluginData, MDataHandle, and MTypeId.

In order to use user defined data, one must first create an instance of the MTypeId class that is initialized with a unique id tag. Then create a new class derived from MPxData to hold the user-defined data, As well as a helper class derived from MPxData that can create instances of the new derived type.

For data of this type that needs to be passed into a plug, one would get an MDataHandle for the attribute that uses the type. This would result in a call to the MPxData helper class that would create an instance of the type inside the MDataHandle. The MDataHandle::data method can then be used to get an get an MObject for the user defined data and this should be used to initialize an instance of MFnPluginData. Then the MFnPluginData::data method can be used to get an MPxData pointer, which can be safely cast to a pointer of the user defined type. The data can be updated through this pointer, after which the MDataHandle::setClean method is used to complete the operation.

To receive data of this type from a plug, an MDataHandle for the attribute that uses the new data type is created. The MDataHandle::type method should be used to ascertain that it contains kPlugin data. Then the MDataHandle::data method is used to get an MObject for the user defined data and this should be used to initialize an instance of MFnPluginData. The MFnPluginData::typeId method can be used to ascertain that the data is in fact of the user defined type. Then the MFnPluginData::data method can be used to get an MPxData pointer, which can be safely cast to a pointer to the user defined type.

+ Examples:
+ Inheritance diagram for MFnPluginData:

Public Member Functions

virtual MFn::Type type () const
 Function set type. More...
 
virtual ~MFnPluginData ()
 Destructor.
 
 MFnPluginData ()
 Default constructor.
 
 MFnPluginData (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
MTypeId typeId (MStatus *ReturnStatus=NULL) const
 Return the unique MTypeId of the user defined data that is held by this instance. More...
 
MPxDatadata (MStatus *ReturnStatus=NULL)
 Return a pointer to the user defined data held in this instance. More...
 
const MPxDataconstData (MStatus *ReturnStatus=NULL) const
 Return a constant pointer to the user defined data held in this instance. More...
 
MObject create (const MTypeId &id, MStatus *ReturnStatus=NULL)
 Create an instance of MPluginData and initialize it to represent user defined data of the given type. More...
 
 MFnPluginData (const MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
- Public Member Functions inherited from MFnData
virtual ~MFnData ()
 Destructor.
 
 MFnData (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
 MFnData ()
 Default class constructor.
 
 MFnData (const MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
- Public Member Functions inherited from MFnBase
virtual ~MFnBase ()
 Class Destructor. More...
 
bool hasObj (MFn::Type) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
bool hasObj (const MObject &) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
MObject object (MStatus *ReturnStatus=NULL) const
 Returns the MObject that is attached to the Function Set. More...
 
virtual MStatus setObject (MObject &object)
 Attaches the Function Set to the specified Maya Object. More...
 
virtual MStatus setObject (const MObject &object)
 NO SCRIPT SUPPORT. More...
 

Protected Member Functions

virtual const char * className () const
 Class name. More...
 

Additional Inherited Members

- Public Types inherited from MFnData
enum  Type {
  kInvalid, kNumeric, kPlugin, kPluginGeometry,
  kString, kMatrix, kStringArray, kDoubleArray,
  kFloatArray, kIntArray, kPointArray, kVectorArray,
  kMatrixArray, kComponentList, kMesh, kLattice,
  kNurbsCurve, kNurbsSurface, kSphere, kDynArrayAttrs,
  kDynSweptGeometry, kSubdSurface, kNObject, kNId,
  kAny, kLast
}
 Types of dependency graph data. More...
 
- Static Public Member Functions inherited from MFnBase
static const char * className ()
 Returns the name of this class. More...
 

Constructor & Destructor Documentation

MFnPluginData ( MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
MFnPluginData ( const MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:

Member Function Documentation

MFn::Type type ( ) const
virtual

Function set type.

Return the class type : MFn::kPluginData.

Reimplemented from MFnData.

const char * className ( ) const
protectedvirtual

Class name.

Return the class name : "MFnPluginData".

Reimplemented from MFnData.

MTypeId typeId ( MStatus ReturnStatus = NULL) const

Return the unique MTypeId of the user defined data that is held by this instance.

Parameters
[out]ReturnStatuskSuccess if the instance is attached to an MObject and kFailure otherwise
Returns
The unique MTypeId of the data held in this instance
MPxData * data ( MStatus ReturnStatus = NULL)

Return a pointer to the user defined data held in this instance.

Parameters
[out]ReturnStatuskSuccess if the instance is attached to an MObject and kFailure otherwise
Returns
A pointer to the MPxData base class for the user defined data
const MPxData * constData ( MStatus ReturnStatus = NULL) const

Return a constant pointer to the user defined data held in this instance.

Parameters
[out]ReturnStatuskSuccess if the instance is attached to an MObject and kFailure otherwise
Returns
A constant pointer to the MPxData base class for the user defined data
MObject create ( const MTypeId id,
MStatus ReturnStatus = NULL 
)

Create an instance of MPluginData and initialize it to represent user defined data of the given type.

Parameters
[in]idthe unique MTypeId of the user defined data class derived from MPxData.
[out]ReturnStatuskSuccess if the create suceeds, and kFailure otherwise
Returns
An MObject that represents an instance of the user defined data type. This will be set to MObject::kNullObj if the create failes.
+ Examples:

The documentation for this class was generated from the following files:
  • MFnPluginData.h
  • MFnPluginData.cpp