Public Member Functions

MPxComponentShape Class Reference

This reference page is linked to from the following overview topics: Parent class descriptions, Shape classes, Components, Example Shapes.


Search for all occurrences

Detailed Description

Component helper class for surface shapes.

MPxComponentShape allows the implementation of new user defined shapes using components. User defined shapes are dependency nodes (and DAG nodes) which contain overridable drawing, selection, and component methods. This class provides enhanced functionality for working with components. As a result, it is a better starting point than MPxSurfaceShape for writing surface shape components.

This class provides methods to manipulate and select the components that make up the shape.

The UI dependent aspects of the shape should be implemented in a class derived from MPxSurfaceShapeUI. This includes the drawing and interactive selection of the shape.

Examples:

apiSimpleShape.h.

#include <MPxComponentShape.h>

Inheritance diagram for MPxComponentShape:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void  transformUsing (const MMatrix &matrix, const MObjectArray &componentList)
  Transform the given components using the specified transformation matrix.
virtual void  transformUsing (const MMatrix &mat, const MObjectArray &componentList, MPxSurfaceShape::MVertexCachingMode cachingMode, MPointArray *pointCache)
  Transform the given components using the specified transformation matrix.
virtual void  componentToPlugs (MObject &component, MSelectionList &list) const
  Converts the given component into a selection list of plugs.
virtual bool  match (const MSelectionMask &mask, const MObjectArray &componentList) const
  This method is used to check for matches between a selection type (or mask) and a given component.
virtual MObject  createFullVertexGroup () const
  This method is used to create a component containing every vertex/CV in the object.
virtual MObject  localShapeInAttr () const
  Returns the input attribute of the shape, which are the control points.
MVectorArray getControlPoints ()
  Extract the control points from the data block and store them locally.
MStatus  setControlPoints (MVectorArray *cps)
  Push the given control points into the node's data block.

Member Function Documentation

void transformUsing ( const MMatrix matrix,
const MObjectArray componentList 
) [virtual]

Transform the given components using the specified transformation matrix.

This method should be overridden if the shape supports components that can be transformed using maya's move, scale, and rotate tools.

Parameters:
[in] matrix the matrix representing the transformation that is to be applied to the components
[in] componentList a list of components to be tranformed

Reimplemented from MPxSurfaceShape.

void transformUsing ( const MMatrix mat,
const MObjectArray componentList,
MPxSurfaceShape::MVertexCachingMode  cachingMode,
MPointArray pointCache 
) [virtual]

Transform the given components using the specified transformation matrix.

This method should be overridden if the shape supports components that can be transformed using maya's move, scale, and rotate tools.

Parameters:
[in] mat the matrix representing the transformation that is to be applied to the components
[in] componentList a list of components to be tranformed. If the list is empty, it indicates that every point in the geometry should be transformed.
[in] cachingMode whether the points should be cached in the pointCache argument, or restored from the pointCache.
[in] pointCache used to store for undo and restore points during undo

Reimplemented from MPxSurfaceShape.

void componentToPlugs ( MObject component,
MSelectionList list 
) const [virtual]

Converts the given component into a selection list of plugs.

This method is used to associate a shapes components into the corresponding attributes (plugs) within the shape.

Parameters:
[in] component the component to be converted
[in] list a selection list where the plug should be added

Reimplemented from MPxSurfaceShape.

bool match ( const MSelectionMask mask,
const MObjectArray componentList 
) const [virtual]

This method is used to check for matches between a selection type (or mask) and a given component.

This method is used to match up your components with selection masks.

This is used by sets and deformers to make sure that the selected components fall into the "vertex only" category. This is useful when you want to make sure that only a particular component can be deformed.

Parameters:
[in] mask the selection mask to test against
[in] componentList a list of components to be tested
Returns:
  • true the match was successfull
  • false the match failed

Reimplemented from MPxSurfaceShape.

MObject createFullVertexGroup ( ) const [virtual]

This method is used to create a component containing every vertex/CV in the object.

This method is supposed to return non-NULL only if the dag object contains vertices/CVs (control points), so derived classes that do should override this method.

Eg: use MFnSingleIndexedComponent::setCompleteData( numVertices ) to specify that a component represents all the vertices of the shape.

Returns:
A component containing all of the vertices in the shape.

Reimplemented from MPxSurfaceShape.

MObject localShapeInAttr ( ) const [virtual]

Returns the input attribute of the shape, which are the control points.

Returns:
The input attribute

Reimplemented from MPxSurfaceShape.

MVectorArray * getControlPoints ( )

Extract the control points from the data block and store them locally.

Returns:
The contol points
MStatus setControlPoints ( MVectorArray cps )

Push the given control points into the node's data block.

Parameters:
[in] cps the control points to use

MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape
MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape MPxComponentShape