MPxGeometryData Class Reference

MPxGeometryData Class Referenceabstract
+ この参照ページは、次の概要トピックと関連付けられています。

#include <MPxGeometryData.h>

Class Description

Base Class for User-defined Dependency Graph Geometry Data Types.

This class is used to provide a wrapper or container for some arbitrary geometry type that you have defined. This allows your data type to exist as typed attributes on dependency nodes and to be passed through dependency graph connections.

MP`xGeometryData is similar to MPxData but includes methods to support sets (also known as groups) and component iteration.

For user defined shapes (MPxSurfaceShape derived classes), in order to support maya's deformers you must declare an MPxGeometryData class as well as a geometry iterator (MPxGeometryIterator).

To register geometry data use MFnPlugin::registerData with the type argument equal to MPxData::kGeometryData.

+ Examples:
+ Inheritance diagram for MPxGeometryData:

Public Member Functions

 MPxGeometryData ()
 Class Constructor.
 
virtual ~MPxGeometryData ()
 Class Destructor.
 
virtual MPxGeometryIteratoriterator (MObjectArray &componentList, MObject &component, bool useComponents)
 Associates a control point based geometry iterator with this data. More...
 
virtual MPxGeometryIteratoriterator (MObjectArray &componentList, MObject &component, bool useComponents, bool world) const
 Associates a control point based geometry iterator with this data. More...
 
virtual bool updateCompleteVertexGroup (MObject &component) const
 This method is used in conjunction with MPxSurfaceShape classes which support maya's deformations. More...
 
virtual bool deleteComponent (const MObjectArray &compList)
 This method should be overridden if this data is to support component deletion. More...
 
virtual bool deleteComponentsFromGroups (const MObjectArray &compList, MIntArray &groupIdArray, MObjectArray &groupComponentArray)
 This method should be overridden to modify the groups that flows along with the geometry, as part of the data, based on the components being deleted. More...
 
virtual void smartCopy (const MPxGeometryData *srcGeom)
 This method is used in conjunction with MPxSurfaceShape classes which support maya's deformations. More...
 
virtual void copy (const MPxData &src)=0
 This method initializes an instance of an MPxGeometryData derived class from another existing instance. More...
 
virtual MTypeId typeId () const =0
 Determines the type id of the Data object. More...
 
virtual MString name () const =0
 Determines the type name of the Data object. More...
 
void setMatrix (const MMatrix &)
 Store the matrix associated to MPxGeometryData. More...
 
const MMatrixmatrix () const
 Return the matrix associated to MPxGeometryData. More...
 
bool matrix (MMatrix &) const
 Return the matrix associated to MPxGeometryData. More...
 
void enableSmartCopy (bool enabled)
 Enable SmartCopy, only for 2017 to fix an issue where smartCopy only happen if user override the function. More...
 
- Public Member Functions inherited from MPxData
 MPxData ()
 Class Constructor. More...
 
virtual ~MPxData ()
 Class Destructor. More...
 
virtual MStatus readASCII (const MArgList &argList, unsigned int &endOfTheLastParsedElement)
 Creates Data in Data Block as specified by input from ASCII file record. More...
 
virtual MStatus readBinary (std::istream &in, unsigned int length)
 Creates Data in Data Block as specified by binary data from the given stream. More...
 
virtual MStatus writeASCII (std::ostream &out)
 Encodes Data in accordance with the ASCII file format and outputs it to the given stream. More...
 
virtual MStatus writeBinary (std::ostream &out)
 Encodes Data in accordance with the binary file format and outputs it to the given stream. More...
 

Additional Inherited Members

- Public Types inherited from MPxData
enum  Type { kData, kGeometryData, kLast }
 Type of the data. More...
 

Member Function Documentation

MPxGeometryIterator * iterator ( MObjectArray componentList,
MObject component,
bool  useComponents 
)
virtual

Associates a control point based geometry iterator with this data.

This method is used in conjunction with MPxSurfaceShape and should be overridden if your shape is to support maya's deformations.

The useComponents argument specifies whether the iteration is over the given componentList or the component.

Parameters
[in]componentLista list of components that are to be iterated over
[in]componenta component to be iterator over
[in]useComponentsif true then componentList is to be iterated over, otherwise the iteration is on component.
Returns
A pointer to an iterator for your geometry
+ Examples:
MPxGeometryIterator * iterator ( MObjectArray componentList,
MObject component,
bool  useComponents,
bool  world 
) const
virtual

Associates a control point based geometry iterator with this data.

This method is used in conjunction with MPxSurfaceShape and should be overridden if your shape is to support maya's deformations.

The useComponents argument specifies whether the iteration is over the given componentList or the component.

This iterator method is called when the iteration is for read only purposes.

Parameters
[in]componentLista list of components that are to be iterated over
[in]componenta component to be iterator over
[in]useComponentsif true then componentList is to be iterated over, otherwise the iteration is on component.
[in]worldspecifies whether the iteration is for world space data
Returns
A pointer to an iterator for your geometry
bool updateCompleteVertexGroup ( MObject component) const
virtual

This method is used in conjunction with MPxSurfaceShape classes which support maya's deformations.

This method should make sure that complete vertex group data is up-to-date. If the given component is not complete (i.e. it represents all elements of your geometry) then you must mark is as complete using the methods of MFnComponent and return true if the component was updated, false if it was already complete.

This method is used by deformers when deforming the "whole" object and not just selected components.

Parameters
[in]componentthe component to test
Returns
Returns true if the component was updated, false if it was already complete
+ Examples:
bool deleteComponent ( const MObjectArray compList)
virtual

This method should be overridden if this data is to support component deletion.

For user defined shapes (MPxSurfaceShape) which support components, this method must be overridden if component deletion is to be supported when the shape has history.

Parameters
[in]compLista list of components that are to be deleted
Returns
true if the deletion was successfull, false otherwise
bool deleteComponentsFromGroups ( const MObjectArray compList,
MIntArray groupIdArray,
MObjectArray groupComponentArray 
)
virtual

This method should be overridden to modify the groups that flows along with the geometry, as part of the data, based on the components being deleted.

It should intelligently update the groups based on what gets deleted. The class MFnGeometryData can be used to access and modify grouping information for data.

The groupIdArray and groupComponentArray should contain the updated grouping information after the deletion has occurred.

Parameters
[in]compLista list of components that are to be deleted
[in]groupIdArrayarray of group id's
[in]groupComponentArrayarray of updated components, one for each group id
Returns
true if the deletion was successfull, false otherwise
void smartCopy ( const MPxGeometryData srcGeom)
virtual

This method is used in conjunction with MPxSurfaceShape classes which support maya's deformations.

This method is used to prvoide maya with an efficient way to copy the source data into the memory of this data with as little memory allocation as possible.

This method is not mandatory and only needs to be overridden to improve performance of deformations on shapes.

Parameters
[in]srcGeoma pointer to the data to be copied
void copy ( const MPxData src)
pure virtual

This method initializes an instance of an MPxGeometryData derived class from another existing instance.

This method can be thought of as the second half of a copy constructor for the class. The default constructor has already been called for the instance, and this method is used to set the private data by copying the values from an existing instance. This is a pure virtual method, and must be overridden in derived classes.

Parameters
[in]srcThe object from which to copy the private data

Implements MPxData.

+ Examples:
MTypeId typeId ( ) const
pure virtual

Determines the type id of the Data object.

This is a pure virtual method, and must be overridden in derived classes.

Returns
Type id of the Data object

Implements MPxData.

+ Examples:
MString name ( ) const
pure virtual

Determines the type name of the Data object.

This is a pure virtual method, and must be overridden in derived classes.

Returns
Type name of the Data object

Implements MPxData.

+ Examples:
void setMatrix ( const MMatrix m)

Store the matrix associated to MPxGeometryData.

The matrix transformation will take place when the data is used, for example in deformer.

Parameters
[in]mthe matrix to transfer a point from local object space to world space.
const MMatrix & matrix ( ) const

Return the matrix associated to MPxGeometryData.

Returns
MMatrix that takes a point from local object space to world space
bool matrix ( MMatrix m) const

Return the matrix associated to MPxGeometryData.

Parameters
[out]mthe returned matrix that takes a point from local object space to world space.
Returns
true if m is not an identity matrix, false otherwise
void enableSmartCopy ( bool  enabled)

Enable SmartCopy, only for 2017 to fix an issue where smartCopy only happen if user override the function.

Parameters
[in]enabledtrue if smartCopy will perform the actual copy, by default this is false and smartCopy won't be called

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