MPxSurfaceShape Class Reference

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

#include <MPxSurfaceShape.h>

Class Description

Parent class of all user defined shapes.

MPxSurfaceShape is the parent class of all user defined shapes. User defined shapes are dependency nodes (and DAG nodes) which contain overridable drawing, selection, and component methods.

This class can be used to implement new kinds of shapes within Maya that can have selectable/manipulatable components and behave in a similar manner to the default shapes in maya.

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 and any components that the shape implements.

+ Examples:
+ Inheritance diagram for MPxSurfaceShape:

Public Types

enum  MVertexCachingMode {
  kNoPointCaching, kSavePoints, kRestorePoints, kUpdatePoints,
  kTransformOriginalPoints
}
 Vertex caching modes. More...
 
enum  MVertexOffsetMode { kNormal, kUTangent, kVTangent, kUVNTriad }
 Vertex offset modes. More...
 
enum  MatchResult {
  kMatchOk, kMatchNone, kMatchTooMany, kMatchInvalidName,
  kMatchInvalidAttribute, kMatchInvalidAttributeIndex, kMatchInvalidAttributeRange, kMatchInvalidAttributeDim
}
 Return values for the matchComponent() method. More...
 
enum  MChildChanged { kObjectChanged, kBoundingBoxChanged }
 Scope of change. More...
 
- Public Types inherited from MPxNode
enum  Type {
  kDependNode, kLocatorNode, kDeformerNode, kManipContainer,
  kSurfaceShape, kFieldNode, kEmitterNode, kSpringNode,
  kIkSolverNode, kHardwareShader, kHwShaderNode, kTransformNode,
  kObjectSet, kFluidEmitterNode, kImagePlaneNode, kParticleAttributeMapperNode,
  kCameraSetNode, kConstraintNode, kManipulatorNode, kMotionPathNode,
  kClientDeviceNode, kThreadedDeviceNode, kAssembly, kSkinCluster,
  kGeometryFilter, kBlendShape, kLast
}
 Defines the type of node. More...
 
enum  SchedulingType {
  kParallel, kSerial, kGloballySerial, kUntrusted,
  kDefaultScheduling = kSerial
}
 Defines the degree of parallelism of a node. More...
 

Public Member Functions

 MPxSurfaceShape ()
 Class constructor. More...
 
virtual ~MPxSurfaceShape ()
 Class destructor.
 
virtual MPxNode::Type type () const
 Returns the type of node that this is. More...
 
virtual bool isBounded () const
 This method should be overridden to return true if the user supplies a bounding box routine. More...
 
virtual MBoundingBox boundingBox () const
 This method should be overridden to return a bounding box for the shape. More...
 
virtual bool evalNodeAffectsDrawDb (const MEvaluationNode &evaluationNode)
 This method should be overridden to return true if the evaluationNode contains any dirty plugs that will affect the drawing of your plug-in. More...
 
virtual void transformUsing (const MMatrix &mat, const MObjectArray &componentList)
 Transform the given components using the specified transformation matrix. More...
 
virtual void transformUsing (const MMatrix &mat, const MObjectArray &componentList, MVertexCachingMode cachingMode, MPointArray *pointCache)
 Transform the given components using the specified transformation matrix. More...
 
virtual void tweakUsing (const MMatrix &mat, const MObjectArray &componentList, MVertexCachingMode cachingMode, MPointArray *pointCache, MArrayDataHandle &handle)
 Transform the given components using the specified transformation matrix. More...
 
bool convertToTweakNodePlug (MPlug &plug) const
 Check if a tweak node is connected to this node. More...
 
virtual void weightedTransformUsing (const MTransformationMatrix &xform, const MMatrix *space, const MObjectArray &componentList, MVertexCachingMode cachingMode, MPointArray *pointCache, const MPlane *freezePlane)
 Transform the given components with interpolation using the specified transformation matrix. More...
 
virtual void weightedTweakUsing (const MTransformationMatrix &xform, const MMatrix *space, const MObjectArray &componentList, MVertexCachingMode cachingMode, MPointArray *pointCache, const MPlane *freezePlane, MArrayDataHandle &handle)
 Transform the given components with interpolation using the specified transformation matrix. More...
 
virtual bool vertexOffsetDirection (MObject &component, MVectorArray &direction, MVertexOffsetMode mode, bool normalize)
 This method should be overridden if the shape supports components that can be moved in the direction of the normal or UV's using the move vertex normal tool. More...
 
virtual MObject newControlPointComponent () const
 The default action of this method is to return an MFnSingleIndexedComponent (of type MFn::kMeshVertComponent) in order to support rigid skinning binds. More...
 
virtual void componentToPlugs (MObject &component, MSelectionList &selectionList) const
 Converts the given component into a selection list of plugs. More...
 
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. More...
 
virtual MatchResult matchComponent (const MSelectionList &item, const MAttributeSpecArray &spec, MSelectionList &list)
 This method is used to convert the string representation of a component into a component object and to validate that the indices. More...
 
virtual MSelectionMask getShapeSelectionMask () const
 This routine must be overridden if the shape is to support interactive object selection in Viewport 2.0 and should provide information about the selection mask of the shape. More...
 
virtual MSelectionMask getComponentSelectionMask () const
 This routine must be overridden if the shape is to support interactive component selection in Viewport 2.0 and should provide information about the selection mask of the shape component. More...
 
virtual MObject createFullVertexGroup () const
 This method is used to create a component containing every vertex/CV in the object. More...
 
virtual MObject createFullRenderGroup () const
 This method is used to create a component containing every renderable element in the object. More...
 
virtual MFn::Type renderGroupComponentType () const
 This method is used to return the type of renderable components for this shape. More...
 
virtual bool deleteComponents (const MObjectArray &componentList, MDoubleArray &undoInfo)
 This method should be overridden if the shape is to support deletion of components. More...
 
virtual bool undeleteComponents (const MObjectArray &componentList, MDoubleArray &undoInfo)
 This method should be overridden if the shape is to support undeletion of components. More...
 
virtual MObject localShapeInAttr () const
 Returns the attribute containing the shape's input geometry in local space. More...
 
virtual MObject localShapeOutAttr () const
 Returns the attribute containing the shape's output geometry in local space. More...
 
virtual MObject worldShapeOutAttr () const
 Returns the attribute containing the shape's output geometry in world space. More...
 
virtual MObject cachedShapeAttr () const
 Returns the attribute containing the shape's cached geometry, if it has one. More...
 
virtual MObject geometryData () const
 Returns the geometry data of the shape. More...
 
virtual bool canMakeLive () const
 This method is used by Maya to determine whether a surface can be made live. More...
 
virtual bool closestPoint (const MPoint &raySource, const MVector &rayDirection, MPoint &theClosestPoint, MVector &theClosestNormal, bool findClosestOnMiss, double tolerance=MPoint_kTol)
 This method is used by Maya for snapping queries when your surface is live. More...
 
virtual void closestPoint (const MPoint &toThisPoint, MPoint &theClosestPoint, double tolerance=MPoint_kTol)
 This method is used by Maya in functions (such as select) that require closest point information from your surface. More...
 
virtual bool pointAtParm (const MPoint &atThisParm, MPoint &evaluatedPoint)
 This method is used by Maya in functions (such as select) that require point at parameter values. More...
 
virtual MPxGeometryIteratorgeometryIteratorSetup (MObjectArray &, MObject &, bool forReadOnly=false)
 This method should be overridden by the user to return a geometry iterator compatible with the user's geometry. More...
 
virtual bool acceptsGeometryIterator (bool writeable=true)
 If the shape can supply a component iterator then then this method should be overridden to return true. More...
 
virtual bool acceptsGeometryIterator (MObject &, bool writeable=true, bool forReadOnly=false)
 If the shape can supply a component iterator then then this method should be overridden to return true. More...
 
virtual bool excludeAsPluginShape () const
 A Maya viewport can be set to not display "Plugin Shapes", which means shapes derived from MPxSurfaceShape. More...
 
MObjectArray activeComponents () const
 Returns a list of active (selected) components for the shape. More...
 
bool hasActiveComponents () const
 This method is used to determine whether or not the shape has active (selected) components. More...
 
void childChanged (MChildChanged=kObjectChanged)
 This method can be used to trigger the shape to recalculate its bounding box. More...
 
bool isRenderable () const
 Returns true if the shape is a renderable shape. More...
 
void setRenderable (bool)
 Specifies whether the shape is a renderable shape. More...
 
MMatrix getWorldMatrix (MDataBlock &, unsigned int) const
 Returns MMatrix which takes a point from local object space to world space. More...
 
- Public Member Functions inherited from MPxNode
 MPxNode ()
 Constructor. More...
 
virtual ~MPxNode ()
 Destructor.
 
virtual void postConstructor ()
 Post constructor. More...
 
virtual MStatus compute (const MPlug &plug, MDataBlock &dataBlock)
 This method should be overridden in user defined nodes. More...
 
virtual bool getInternalValueInContext (const MPlug &plug, MDataHandle &dataHandle, MDGContext &ctx)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual bool setInternalValueInContext (const MPlug &plug, const MDataHandle &dataHandle, MDGContext &ctx)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual bool getInternalValue (const MPlug &plug, MDataHandle &dataHandle)
 This method is obsolete. More...
 
virtual bool setInternalValue (const MPlug &plug, const MDataHandle &dataHandle)
 This method is obsolete. More...
 
virtual int internalArrayCount (const MPlug &plug, const MDGContext &ctx) const
 This method is overridden by nodes that have internal array attributes which are not stored in Maya's datablock. More...
 
virtual void copyInternalData (MPxNode *)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual MStatus legalConnection (const MPlug &plug, const MPlug &otherPlug, bool asSrc, bool &isLegal) const
 This method allows you to check for legal connections being made to attributes of this node. More...
 
virtual MStatus legalDisconnection (const MPlug &plug, const MPlug &otherPlug, bool asSrc, bool &isLegal) const
 This method allows you to check for legal disconnections being made to attributes of this node. More...
 
virtual MStatus setDependentsDirty (const MPlug &plug, MPlugArray &plugArray)
 This method can be overridden in user defined nodes to specify which plugs should be set dirty based upon an input plug {plugBeingDirtied} which Maya is marking dirty. More...
 
virtual MStatus preEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode)
 Prepare a node's internal state for threaded evaluation. More...
 
virtual MStatus postEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode, PostEvaluationType evalType)
 Clean up node's internal state after threaded evaluation. More...
 
virtual SchedulingType schedulingType () const
 When overridden this method controls the degree of parallelism supported by the node during threaded evaluation. More...
 
virtual MStatus connectionMade (const MPlug &plug, const MPlug &otherPlug, bool asSrc)
 This method gets called when connections are made to attributes of this node. More...
 
virtual MStatus connectionBroken (const MPlug &plug, const MPlug &otherPlug, bool asSrc)
 This method gets called when connections are broken with attributes of this node. More...
 
virtual MStatus dependsOn (const MPlug &plug, const MPlug &otherPlug, bool &depends) const
 This method may be overridden by the user defined node. More...
 
virtual bool isPassiveOutput (const MPlug &plug) const
 This method may be overridden by the user defined node if it wants to provide output attributes which do not prevent value modifications to the destination attribute. More...
 
virtual MStatus shouldSave (const MPlug &plug, bool &isSaving)
 This method may be overridden by the user defined node. More...
 
virtual MPlug passThroughToOne (const MPlug &plug) const
 This method may be overridden by nodes that have a one-to-one relationship between an input attribute and a corresponding output attribute. More...
 
virtual bool passThroughToMany (const MPlug &plug, MPlugArray &plugArray) const
 This method is overridden by nodes that want to control the traversal behavior of some Maya search algorithms which traverse the history/future of shape nodes looking for directly related nodes. More...
 
virtual bool isAbstractClass () const
 Override this class to return true if this node is an abstract node. More...
 
virtual MStringArray getFilesToArchive (bool shortName=false, bool unresolvedName=false, bool markCouldBeImageSequence=false) const
 Use this method to return all external files used by this node. More...
 
virtual void getExternalContent (MExternalContentInfoTable &table) const
 Returns the external content (files) that this node depends on. More...
 
bool addExternalContentForFileAttr (MExternalContentInfoTable &table, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
bool setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &table)
 Sets content info in the specified attribute from the table. More...
 
virtual void setExternalContent (const MExternalContentLocationTable &table)
 Changes the location of external content in batch. More...
 
virtual MTypeId typeId () const
 Returns the TYPEID of this node. More...
 
virtual MString typeName () const
 Returns the type name of this node. More...
 
virtual MString name () const
 Returns the name of this particular instance of this class. More...
 
virtual MObject thisMObject () const
 Returns the MObject associated with this user defined node. More...
 
virtual MStatus setExistWithoutInConnections (bool flag)
 This method specifies whether or not the node can exist without input connections. More...
 
virtual bool existWithoutInConnections (MStatus *ReturnStatus=NULL) const
 Determines whether or not this node can exist without input connections. More...
 
virtual MStatus setExistWithoutOutConnections (bool flag)
 This method specifies whether or not the node can exist without output connections. More...
 
virtual bool existWithoutOutConnections (MStatus *ReturnStatus=NULL) const
 Determines whether or not this node can exist without output connections. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MPxNode
static MStatus addAttribute (const MObject &attr)
 This method adds a new attribute to a user defined node type during the type's initialization. More...
 
static MStatus inheritAttributesFrom (const MString &parentClassName)
 This method allows a class of plugin node to inherit all of the attributes of a second class of plugin node. More...
 
static MStatus attributeAffects (const MObject &whenChanges, const MObject &isAffected)
 This method specifies that a particular input attribute affects a specific output attribute. More...
 
static const char * className ()
 Returns the name of this class. More...
 

Static Public Attributes

static MObject mControlPoints
 Control points for the derived shapes.
 
static MObject mControlValueX
 X value of a control point.
 
static MObject mControlValueY
 Y value of a control point.
 
static MObject mControlValueZ
 Z value of a control point.
 
static MObject nodeBoundingBox
 bounding box attribute
 
static MObject nodeBoundingBoxMin
 bounding box minimum point
 
static MObject nodeBoundingBoxMinX
 X component of boundingBoxMin.
 
static MObject nodeBoundingBoxMinY
 Y component of boundingBoxMin.
 
static MObject nodeBoundingBoxMinZ
 Z component of boundingBoxMin.
 
static MObject nodeBoundingBoxMax
 bounding box maximum point
 
static MObject nodeBoundingBoxMaxX
 X component of boundingBoxMax.
 
static MObject nodeBoundingBoxMaxY
 Y component of boundingBoxMax.
 
static MObject nodeBoundingBoxMaxZ
 Z component of boundingBoxMax.
 
static MObject nodeBoundingBoxSize
 bounding box size vector
 
static MObject nodeBoundingBoxSizeX
 X component of boundingBoxSize.
 
static MObject nodeBoundingBoxSizeY
 Y component of boundingBoxSize.
 
static MObject nodeBoundingBoxSizeZ
 Z component of boundingBoxSize.
 
static MObject center
 object center attribute
 
static MObject boundingBoxCenterX
 X component of boundingBoxCenter.
 
static MObject boundingBoxCenterY
 Y component of boundingBoxCenter.
 
static MObject boundingBoxCenterZ
 Z component of boundingBoxCenter.
 
static MObject matrix
 matrix attribute
 
static MObject inverseMatrix
 inverse matrix attribute
 
static MObject worldMatrix
 world matrix attribute
 
static MObject worldInverseMatrix
 inverse world matrix attribute
 
static MObject parentMatrix
 parent matrix attribute
 
static MObject parentInverseMatrix
 inverse parent matrix attribute
 
static MObject visibility
 visibility attribute
 
static MObject intermediateObject
 intermediate object attribute
 
static MObject isTemplated
 template attribute
 
static MObject instObjGroups
 instances object group info attribute
 
static MObject objectGroups
 object groups attributes
 
static MObject objectGrpCompList
 component in object groups attribute
 
static MObject objectGroupId
 group id attribute
 
static MObject objectGroupColor
 group id attribute
 
static MObject useObjectColor
 controls choice of wireframe dormant object color
 
static MObject objectColor
 the per object dormant wireframe color
 
- Static Public Attributes inherited from MPxNode
static MObject message
 message attribute
 
static MObject isHistoricallyInteresting
 is historically interesting attribute
 
static MObject caching
 caching attribute
 
static MObject state
 state attribute
 
static MObject frozen
 frozen attribute
 

Additional Inherited Members

- Protected Member Functions inherited from MPxNode
virtual MDataBlock forceCache (MDGContext &ctx=MDGContext::fsNormal)
 USE _forceCache() IN SCRIPT. More...
 
virtual void setMPSafe (bool flag)
 USE _setMPSafe() IN SCRIPT. More...
 
virtual MStatus setDoNotWrite (bool flag)
 USE _setDoNotWrite() IN SCRIPT. More...
 
virtual bool doNotWrite (MStatus *ReturnStatus=NULL) const
 USE _doNotWrite() IN SCRIPT. More...
 

Member Enumeration Documentation

Vertex caching modes.

Enumerator
kNoPointCaching 

No point caching.

kSavePoints 

Points should be saved for undo in the point cache.

kRestorePoints 

Points should be restored from the point cache.

kUpdatePoints 

Transform and update the points in the point cache.

kTransformOriginalPoints 

Transform using use the original pre-transformation values stored in the pointCache.

Vertex offset modes.

Enumerator
kNormal 

Move in normal direction.

kUTangent 

Move in u tangent direction.

kVTangent 

Move in v tangent direction.

kUVNTriad 

Calculate u, v, and normal offsets.

Return values for the matchComponent() method.

Enumerator
kMatchOk 

The component was matched without error.

kMatchNone 

No component was matched.

kMatchTooMany 

Not used.

kMatchInvalidName 

One of the names in the attribute specification was not valid.

kMatchInvalidAttribute 

Not used.

kMatchInvalidAttributeIndex 

The attribute specification contained an index for a non-array attribute.

kMatchInvalidAttributeRange 

An attribute index was out of range.

kMatchInvalidAttributeDim 

The attribute specification provided the wrong number of dimensions for an attribute.

Scope of change.

Enumerator
kObjectChanged 

Object geometry changed. Internal caches need to be updated.

kBoundingBoxChanged 

Object geometry is unchanged but its bounding box has changed.

This might happen if the object was moved or an offset changed.

Constructor & Destructor Documentation

Class constructor.

Any calls the MPxSurfaceShape methods must be done in the postConstructor method and not here.

Member Function Documentation

MPxNode::Type type ( ) const
virtual

Returns the type of node that this is.

This is used to differentiate user defined nodes that are derived off different MPx base classes.

It is not necessary to override this method.

Returns
Type of the node (MPxNode::kSurfaceShape)

Reimplemented from MPxNode.

bool isBounded ( ) const
virtual

This method should be overridden to return true if the user supplies a bounding box routine.

Supplying a bounding box routine makes refresh and selection more efficient.

Returns
A boolean value indicating whether a bounding box routine has been supplied
+ Examples:
MBoundingBox boundingBox ( ) const
virtual

This method should be overridden to return a bounding box for the shape.

If this method is overridden, then MPxSurfaceShape::isBounded should also be overridden to return true.

Returns
The bounding box of the shape
+ Examples:
bool evalNodeAffectsDrawDb ( const MEvaluationNode evaluationNode)
virtual

This method should be overridden to return true if the evaluationNode contains any dirty plugs that will affect the drawing of your plug-in.

Parameters
[in]evaluationNodeEvaluation information for this surface node
Returns
True if the evaluationNode contains plugs that will affect drawing
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]matrixthe matrix representing the transformation that is to be applied to the components
[in]componentLista list of components to be tranformed. If the list is empty, it indicates that every point in the geometry should be transformed.

Reimplemented in MPxComponentShape.

+ Examples:
void transformUsing ( const MMatrix mat,
const MObjectArray componentList,
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]matthe matrix representing the transformation that is to be applied to the components
[in]componentLista list of components to be transformed. If the list is empty, it indicates that every point in the geometry should be transformed.
[in]cachingModewhether the points should be cached in the pointCache argument, or restored from the pointCache
[in]pointCacheused to store for undo and restore points during undo

Reimplemented in MPxComponentShape.

void tweakUsing ( const MMatrix mat,
const MObjectArray componentList,
MVertexCachingMode  cachingMode,
MPointArray pointCache,
MArrayDataHandle handle 
)
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. This method is called when the shape has history & connected to a tweak node. The most common reason why the shape would be connected to a tweak node is if it is being deformed. When a shape is connected to a tweak node, transformations applied to the points are placed in the tweak node rather than in the shape itself.

Parameters
[in]matthe matrix representing the transformation that is to be applied to the components
[in]componentLista list of components to be tranformed. If the list is empty, it indicates that every point in the geometry should be transformed.
[in]cachingModewhether the points should be cached in the pointCache argument, or restored from the pointCache
[in]pointCacheused to store for undo and restore points during undo
[in]handlearray data handle where the tweaks are stored
+ Examples:
bool convertToTweakNodePlug ( MPlug plug) const

Check if a tweak node is connected to this node.

If it is, then reset the supplied plug to contain the controlPoints attribute on the tweak node.

Parameters
[in]plugplug which will be set to point to the associated tweak node plug if a tweak node is connected
Returns
true if a tweak node was found, false if the plug was unchanged
void weightedTransformUsing ( const MTransformationMatrix xform,
const MMatrix space,
const MObjectArray componentList,
MVertexCachingMode  cachingMode,
MPointArray pointCache,
const MPlane freezePlane 
)
virtual

Transform the given components with interpolation using the specified transformation matrix.

If not overridden, then a default implementation will be used to perform the transformation and interpolation. The default implementation calls setPoint() for each transformed point.

Parameters
[in]xformthe matrix representing the transformation that is to be applied to the components
[in]spacethe matrix representing the transformation space to perform the interpolated transformation. A value of NULL indicates it should be ignored.
[in]componentLista list of components to be transformed and their weights. This list will not be empty.
[in]cachingModewhether the points should be added/updated in the pointCache, restored from the pointCache, or transform using use the original values in the pointCache.
[in]pointCacheused to store for undo and restore points during undo
[in]freezePlaneused for symmetric transformation of components. A value of NULL indicates it is not used and there is no symmetric transformation.
+ Examples:
void weightedTweakUsing ( const MTransformationMatrix xform,
const MMatrix space,
const MObjectArray componentList,
MVertexCachingMode  cachingMode,
MPointArray pointCache,
const MPlane freezePlane,
MArrayDataHandle handle 
)
virtual

Transform the given components with interpolation using the specified transformation matrix.

This method is called for transforming components using maya's move, scale, and rotate tools when the shape has history and is connected to a tweak node. The most common reason why the shape would be connected to a tweak node is if it is being deformed. When a shape is connected to a tweak node, transformations applied to the points are placed in the tweak node rather than in the shape itself.

If not overridden, then a default implementation will be used to perform the transformation and interpolation. The default implementation calls setPoint() for each transformed point.

Parameters
[in]xformthe matrix representing the transformation that is to be applied to the components
[in]spacethe matrix representing the transformation space to perform the interpolated transformation. A value of NULL indicates it should be ignored.
[in]componentLista list of components to be transformed and their weights. This list will not be empty.
[in]cachingModewhether the points should be added/updated in the pointCache, restored from the pointCache, or transform using the original values in the pointCache.
[in]pointCacheused to store for undo and restore points during undo
[in]freezePlaneused for symmetric transformation of components. A value of NULL indicates it is not used and there is no symmetric transformation.
[in]handlearray data handle where the tweaks are stored
+ Examples:
bool vertexOffsetDirection ( MObject component,
MVectorArray direction,
MVertexOffsetMode  mode,
bool  normalize 
)
virtual

This method should be overridden if the shape supports components that can be moved in the direction of the normal or UV's using the move vertex normal tool.

This method should calculate the offset direction for a vertex components. The direction vector array is an array of offsets corresponding to the elements in the component. The mode argument specifies the type of movement that is being performed.

The default for this method is to return false, i.e. no support for move normal tool.

Parameters
[in]component
[in]direction
[in]modeThe type of vertex movement
  • mode = 0 -> normal
  • mode = 1 -> U
  • mode = 2 -> V
  • mode = 3 -> UVN triad
Parameters
[in]normalizespecifies whether the offset vectors should be normalized
Returns
true if the shape supports the current mode, false if the shape cannot do the requested vertex move
+ Examples:
MObject newControlPointComponent ( ) const
virtual

The default action of this method is to return an MFnSingleIndexedComponent (of type MFn::kMeshVertComponent) in order to support rigid skinning binds.

This method can be overridden to support other types of components such as MFnDoubleIndexedComponent and MFnTripleIndexedComponent and should return a new component of that type. The types allowed are those listed in the create() method docs for each MFn*IndexedComponent.

No argument is required.

The skinning code handles the deallocation of the new component.

Returns
The new component
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. For example, it gets called by the translate manipulator to determine which attributes should be driven by the manipulator, and by the setKeyframe command to determine where to connect animCurves for components.

This method should be overridden if the shape supports components that can be selected and moved in Maya.

Parameters
[in]componentthe component to be converted
[in]lista selection list where the plug should be added

Reimplemented in MPxComponentShape.

+ Examples:
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.

If your shape has components representing attributes then 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]maskthe selection mask to test against
[in]componentLista list of components to be tested
Returns
  • true the match was successfull
  • false the match failed

Reimplemented in MPxComponentShape.

+ Examples:
MPxSurfaceShape::MatchResult matchComponent ( const MSelectionList item,
const MAttributeSpecArray spec,
MSelectionList list 
)
virtual

This method is used to convert the string representation of a component into a component object and to validate that the indices.

This method should be overridden if the shape has components.

Parameters
[in]itemDAG selection item for the object being matched
[in]specattribute specification object
[in]listlist to add components to
Returns
The component match result
+ Examples:
MSelectionMask getShapeSelectionMask ( ) const
virtual

This routine must be overridden if the shape is to support interactive object selection in Viewport 2.0 and should provide information about the selection mask of the shape.

Returns
The selection mask of the shape.
+ Examples:
MSelectionMask getComponentSelectionMask ( ) const
virtual

This routine must be overridden if the shape is to support interactive component selection in Viewport 2.0 and should provide information about the selection mask of the shape component.

Returns
The selection mask of the shape components.
+ Examples:
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 in MPxComponentShape.

+ Examples:
MObject createFullRenderGroup ( ) const
virtual

This method is used to create a component containing every renderable element in the object.

This method is supposed to return non-NULL only if the dag object contains renderable components. Type of the return component should is the same as the one returned by MPxSurfaceShape::renderGroupComponentType().

See also
MPxSurfaceShape::renderGroupComponentType()

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

Returns
A component containing all of renderable elements in the shape.
MFn::Type renderGroupComponentType ( ) const
virtual

This method is used to return the type of renderable components for this shape.

It should return a type among MFn::kMeshPolygonComponent, MFn::kSubdivFaceComponent and MFn::kSurfaceFaceComponent, which is used in the creation of per-face/patch shader assignment.

See also
MFnSet::addMember(const MDagPath &, const MObject &)
Returns
the type of renderable components for this shape.
bool deleteComponents ( const MObjectArray componentList,
MDoubleArray undoInfo 
)
virtual

This method should be overridden if the shape is to support deletion of components.

A list of components to be deleted will be passed in as well as an array of doubles where information about each deleted component can be stored for undo purposes. A typical use for this array is to store knot values or weights for control points that are deleted.

Parameters
[in]componentListList of components to be deleted
[in]undoInfoValues used for undo purposes
Returns
true if this method was successful, false otherwise
bool undeleteComponents ( const MObjectArray componentList,
MDoubleArray undoInfo 
)
virtual

This method should be overridden if the shape is to support undeletion of components.

A list of components to be deleted will be passed in as well as an array of doubles where information about each deleted component is stored for undo purposes. A typical use for this array is to store knot values or weights for control points that are deleted.

Parameters
[in]componentListList of components that were deleted
[in]undoInfoValues used for undo purposes
Returns
true if this method was successful, false otherwise
MObject localShapeInAttr ( ) const
virtual

Returns the attribute containing the shape's input geometry in local space.

The attribute must be writable and of a geometry data type (e.g. MFn::kGeometryData, MFn::kPluginGeometryData, etc).

This method will be called by Maya to determine if the shape has construction history and must be overridden if the shape is to support deformers.

Returns
The input attribute

Reimplemented in MPxComponentShape.

+ Examples:
MObject localShapeOutAttr ( ) const
virtual

Returns the attribute containing the shape's output geometry in local space.

The attribute must be readable and of a geometry data type (e.g. MFn::kGeometryData, MFn::kPluginGeometryData, etc).

This method must be overridden if the shape is to support deformers.

Returns
The output attribute
+ Examples:
MObject worldShapeOutAttr ( ) const
virtual

Returns the attribute containing the shape's output geometry in world space.

The attribute must be readable and of a geometry data type (e.g. MFn::kGeometryData, MFn::kPluginGeometryData, etc).

This method must be overridden if the shape is to support deformers.

Returns
The world space output attribute
+ Examples:
MObject cachedShapeAttr ( ) const
virtual

Returns the attribute containing the shape's cached geometry, if it has one.

The attribute must be readable, writable and of a geometry data type (e.g. MFn::kGeometryData, MFn::kPluginGeometryData, etc).

Returns
The attribute that stores the cached shape
+ Examples:
MObject geometryData ( ) const
virtual

Returns the geometry data of the shape.

The geometry data must be derived from the MPxGeometryData class.

The data is used by Maya to add, edit and query component grouping (set) information for the shape. This set information is stored and managed by Maya's shape base class, geometryShape.

Returns
The geometry data of the shape
+ Examples:
bool canMakeLive ( ) const
virtual

This method is used by Maya to determine whether a surface can be made live.

It can be overridden to return true if you wish to allow your surface to be made live. If you return true, you will also need to implement both closestPoint() overloads. The default is to return false.

Returns
true if the surface can be made live, false otherwise
bool closestPoint ( const MPoint raySource,
const MVector rayDirection,
MPoint theClosestPoint,
MVector theClosestNormal,
bool  findClosestOnMiss,
double  tolerance = MPoint_kTol 
)
virtual

This method is used by Maya for snapping queries when your surface is live.

If you override this method, you should set theClosestPoint to the closest point on your surface intersected by the ray defined by raySource and rayDirection. You should also populate the theClosestNormal parameter with the surface normal at that intersection point.

If no intersection is found and findClosestOnMiss is true, you should still provide a point on your surface closest to the ray defined by raySource and rayDirection. When used for live snapping, this allows the user to click and drag outside the bounds of a live surface and still have it snap to the nearest point on it within the viewport. Note, performing a pure 3D closest point of approach test in this situation may not give the most natural result for live mesh snapping. To provide behavior that matches Maya, you can project your surface onto the plane defined by the ray, then perform your calculations. This will account for view perspective and give accurate live snap points along the silhouette of the surface.

If findClosestOnMiss is false, you should not provide a point and normal when the ray misses.

canMakeLive() must also be overridden to return true.

Parameters
[in]raySourcethe origin of the ray to test against
[in]rayDirectionthe direction of the ray to test against
[out]theClosestPointthe closest point on your surface
[out]theClosestNormalthe normal at the closest point on your surface
[in]findClosestOnMisswhen true, you should calculate theClosestPoint and theClosestNormal even if the ray misses your surface.
[in]tolerancetolerance to use in your calculations
Returns
true if theClosestPoint and theClosestNormal have been set, false otherwise
+ Examples:
void closestPoint ( const MPoint toThisPoint,
MPoint theClosestPoint,
double  tolerance = MPoint_kTol 
)
virtual

This method is used by Maya in functions (such as select) that require closest point information from your surface.

If you've overridden canMakeLive() to return true, this method is also used by Maya for some snapping queries when your surface is live.

Parameters
[in]toThisPointthe point to test against
[out]theClosestPointthe closest point on your surface
[in]tolerancetolerance to use in your calculations
bool pointAtParm ( const MPoint atThisParm,
MPoint evaluatedPoint 
)
virtual

This method is used by Maya in functions (such as select) that require point at parameter values.

This only makes sense for parametric surfaces such as NURBS.

Parameters
[in]atThisParmthe parameter to check
[out]evaluatedPointthe surface point
Returns
true if a point was found, false otherwise
MPxGeometryIterator * geometryIteratorSetup ( MObjectArray componentList,
MObject components,
bool  forReadOnly = false 
)
virtual

This method should be overridden by the user to return a geometry iterator compatible with the user's geometry.

A geometry iterator is used for iterating over the components of a shape, such as the vertices of a mesh, in a generic manner.

The components to be iterated over are passed to this function in on of two ways, as a list of components, or as a single component. Only one of these arguments is used at any particular time.

Parameters
[in]componentLista list of components to be iterated over
[in]componentsthe components to be iterated over
[in]forReadOnlyspecifies whether the iterator is for read-only
Returns
The component match result
+ Examples:
bool acceptsGeometryIterator ( bool  writeable = true)
virtual

If the shape can supply a component iterator then then this method should be overridden to return true.

The default is to return false.

Parameters
[in]writeableis this component type writable by an iterator
Returns
  • true the shape can supply an iterator
  • false the shape cannot supply an iterator
+ Examples:
bool acceptsGeometryIterator ( MObject component,
bool  writeable = true,
bool  forReadOnly = false 
)
virtual

If the shape can supply a component iterator then then this method should be overridden to return true.

The default is to return false. The component argument can be used to when the shape has multiple components and not all of them can be iterator over.

Parameters
[in]componentthe component to test
[in]writeableis this component type writable by an iterator
[in]forReadOnlyis this component type readable by an iterator
Returns
  • true the shape can supply an iterator
  • false the shape cannot supply an iterator
bool excludeAsPluginShape ( ) const
virtual

A Maya viewport can be set to not display "Plugin Shapes", which means shapes derived from MPxSurfaceShape.

By overriding excludeAsPluginShape() to return false, you can change that behaviour so that this shape is still displayed even when the display of "Plugin Shapes" is disabled.

The default implementation returns true.

Returns
true to have this shape obey the "Plugin Shapes" settings in the viewport's "Show" menu; false to have it ignore that setting
MObjectArray activeComponents ( ) const

Returns a list of active (selected) components for the shape.

Returns
An array of active components
bool hasActiveComponents ( ) const

This method is used to determine whether or not the shape has active (selected) components.

Returns
  • true there are active components
  • false there are no active components
void childChanged ( MChildChanged  state = kObjectChanged)

This method can be used to trigger the shape to recalculate its bounding box.

Parameters
[in]statethe type of change that has occurred
bool isRenderable ( ) const

Returns true if the shape is a renderable shape.

Making a shape renderable allows the shape to have shading group assignments.

Returns
  • true the shape is renderable
  • false the shape is not renderable
void setRenderable ( bool  flag)

Specifies whether the shape is a renderable shape.

Making a shape renderable allows the shape to have shading group assignments.

Parameters
[in]flagtrue if the shape is to be renderable, false otherwise
MMatrix getWorldMatrix ( MDataBlock block,
unsigned int  instanceGeom 
) const

Returns MMatrix which takes a point from local object space to world space.

Parameters
[in]blocka MDataBlock
[in]instanceGeomthe instance this MPxSurfaceShape corresponds to
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

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