class MPxSurfaceShape

Jump to documentation

: public MPxNode parent class of all user defined shapes. (OpenMaya) (OpenMayaMPx.py)

Inheritance:

MPxSurfaceShape < MPxNode

public members:

MPxSurfaceShape ()
virtual ~MPxSurfaceShape ()
virtual MPxNode::Type type () const
virtual bool isBounded () const
virtual MBoundingBox boundingBox () const
enum MVertexCachingMode
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
update the points
virtual void transformUsing ( const MMatrix & mat, const MObjectArray & componentList )
virtual void transformUsing ( const MMatrix & mat, const MObjectArray & componentList, MVertexCachingMode cachingMode, MPointArray * pointCache)
virtual void tweakUsing ( const MMatrix & mat, const MObjectArray & componentList, MVertexCachingMode cachingMode, MPointArray * pointCache, MArrayDataHandle & handle )
bool convertToTweakNodePlug ( MPlug & plug) const
enum MVertexOffsetMode
kNormal
move in normal direction
kUTangent
move in u tangent direction
kVTangent
move in v tangent direction
kUVNTriad
calculate u, v, and normal offsets
virtual bool vertexOffsetDirection ( MObject & component, MVectorArray & direction, MVertexOffsetMode mode, bool normalize )
virtual MObject newControlPointComponent ( ) const
virtual void componentToPlugs ( MObject & component, MSelectionList & selectionList ) const
virtual bool match ( const MSelectionMask & mask, const MObjectArray & componentList ) const
enum MatchResult
kMatchOk
kMatchNone
kMatchTooMany
kMatchInvalidName
kMatchInvalidAttribute
kMatchInvalidAttributeIndex
kMatchInvalidAttributeRange
kMatchInvalidAttributeDim
virtual MatchResult matchComponent ( const MSelectionList & item, const MAttributeSpecArray & spec, MSelectionList & list )
virtual MObject createFullVertexGroup () const
virtual bool deleteComponents ( const MObjectArray & componentList, MDoubleArray & undoInfo )
virtual bool undeleteComponents ( const MObjectArray & componentList, MDoubleArray & undoInfo )
virtual MObject localShapeInAttr () const
virtual MObject localShapeOutAttr () const
virtual MObject worldShapeOutAttr () const
virtual MObject cachedShapeAttr () const
virtual MObject geometryData () const
virtual void closestPoint ( const MPoint & toThisPoint, MPoint & theClosestPoint, double tolerance )
virtual bool pointAtParm ( const MPoint & atThisParm, MPoint & evaluatedPoint )
virtual MPxGeometryIterator * geometryIteratorSetup ( MObjectArray &, MObject &, bool forReadOnly = false )
virtual bool acceptsGeometryIterator ( bool writeable=true )
virtual bool acceptsGeometryIterator ( MObject &, bool writeable=true, bool forReadOnly = false)
MObjectArray activeComponents () const
bool hasActiveComponents () const
enum MChildChanged
kObjectChanged
kBoundingBoxChanged
void childChanged ( MChildChanged = kObjectChanged )
bool isRenderable () const
void setRenderable ( bool )
MMatrix getWorldMatrix ( MDataBlock &, unsigned int ) const
static MObject mHasHistoryOnCreate
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

Inherited from MPxNode:

public members:

enum Type
kDependNode
kLocatorNode
kDeformerNode
kManipContainer
kSurfaceShape
kFieldNode
kEmitterNode
kSpringNode
kIkSolverNode
kHardwareShader
Custom shader derived from MPxHardwareShader
kHwShaderNode
Custom shader derived from MPxHwShaderNode
kTransformNode
kObjectSet
kFluidEmitterNode
kImagePlaneNode
kParticleAttributeMapperNode
kConstraintNode
kLast
virtual void postConstructor ()
virtual MStatus compute ( const MPlug & plug, MDataBlock & dataBlock )
virtual bool getInternalValueInContext ( const MPlug & plug, MDataHandle & dataHandle, MDGContext & ctx)
virtual bool setInternalValueInContext ( const MPlug & plug, const MDataHandle & dataHandle, MDGContext & ctx)
virtual bool getInternalValue ( const MPlug & plug, MDataHandle & dataHandle)
virtual bool setInternalValue ( const MPlug & plug, const MDataHandle & dataHandle)
virtual int internalArrayCount ( const MPlug & plug, const MDGContext & ctx) const
virtual void copyInternalData ( MPxNode * )
virtual MStatus legalConnection ( const MPlug & plug, const MPlug & otherPlug, bool asSrc, bool& isLegal ) const
virtual MStatus legalDisconnection ( const MPlug & plug, const MPlug & otherPlug, bool asSrc, bool& isLegal ) const
virtual MStatus setDependentsDirty ( const MPlug & plug, MPlugArray & plugArray)
virtual MStatus connectionMade ( const MPlug & plug, const MPlug & otherPlug, bool asSrc )
virtual MStatus connectionBroken ( const MPlug & plug, const MPlug & otherPlug, bool asSrc )
virtual bool isPassiveOutput ( const MPlug & plug ) const
virtual MStatus shouldSave ( const MPlug & plug, bool& isSaving )
virtual MPlug passThroughToOne ( const MPlug & plug ) const
virtual bool passThroughToMany ( const MPlug & plug, MPlugArray & plugArray ) const
MTypeId typeId () const
MString typeName () const
MString name () const
virtual Type type () const
virtual bool isAbstractClass () const
MObject thisMObject () const
static MStatus addAttribute ( const MObject & attr )
static MStatus inheritAttributesFrom ( const MString & parentClassName )
static MStatus attributeAffects ( const MObject & whenChanges, const MObject & isAffected )
MStatus setExistWithoutInConnections ( bool flag )
bool existWithoutInConnections ( MStatus * ReturnStatus = NULL ) const
MStatus setExistWithoutOutConnections ( bool flag )
bool existWithoutOutConnections ( MStatus * ReturnStatus = NULL ) const
static MObject message
static MObject isHistoricallyInteresting
static MObject caching
static MObject state

protected members:

MDataBlock forceCache ( MDGContext & ctx= MDGContext::fsNormal )
void setMPSafe ( bool flag )
MStatus setDoNotWrite ( bool flag )
bool doNotWrite ( MStatus *ReturnStatus = NULL ) const

Documentation

parent class of all user defined shapes. (OpenMaya) (OpenMayaMPx.py)
Description

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.

Functions

MPxSurfaceShape:: MPxSurfaceShape ()

Description

Class constructor.

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

MPxSurfaceShape:: ~MPxSurfaceShape ()

Description

Class destructor.

MPxNode::Type MPxSurfaceShape:: type () const

Description

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.

Return Value

  • Type of the node (MPxNode::kSurfaceShape)

bool MPxSurfaceShape:: isBounded () const

Description

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.

Return Value

  • a boolean value indicating whether a bounding box routine has been supplied

MBoundingBox MPxSurfaceShape:: boundingBox () const

Description

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.

Return Value

  • the bounding box of the shape

void MPxSurfaceShape:: transformUsing ( const MMatrix & matrix , const MObjectArray & componentList )

Description

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.

Arguments

  • matrix the matrix representing the transformation that is to be applied to the components
  • componentList a list of components to be tranformed. If the list is empty, it indicates that every point in the geometry should be transformed.

void MPxSurfaceShape:: transformUsing ( const MMatrix & mat, const MObjectArray & componentList, MVertexCachingMode cachingMode, MPointArray * pointCache)

Description

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.

Arguments

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

void MPxSurfaceShape:: tweakUsing ( const MMatrix & mat, const MObjectArray & componentList, MVertexCachingMode cachingMode, MPointArray * pointCache, MArrayDataHandle & handle )

Description

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.

Arguments

  • matrix the matrix representing the transformation that is to be applied to the components
  • componentList a list of components to be tranformed. If the list is empty, it indicates that every point in the geometry should be transformed.
  • cachingMode whether the points should be cached in the pointCache argument, or restored from the pointCache
  • pointCache used to store for undo and restore points during undo
  • handle array data handle where the tweaks are stored

bool MPxSurfaceShape:: convertToTweakNodePlug ( MPlug & plug) const

Description

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.

Arguments

  • plug plug which will be set to point to the associated tweak node plug if a tweak node is connected

Return Value

  • true if a tweak node was found, false if the plug was unchanged

bool MPxSurfaceShape:: vertexOffsetDirection ( MObject & component, MVectorArray & direction, MVertexOffsetMode mode, bool normalize )

Description

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.

Arguments

  • component
  • direction
  • mode The type of vertex movement
    • mode = 0 -> normal
    • mode = 1 -> U
    • mode = 2 -> V
    • mode = 3 -> UVN triad
  • normalize specifies whether the offset vectors should be normalized

Return Value

  • true if the shape supports the current mode, false if the shape cannot do the requested vertex move

MObject MPxSurfaceShape:: newControlPointComponent ( ) const

Description

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 overriden 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.

Return Value

  • the new component

void MPxSurfaceShape:: componentToPlugs ( MObject & component, MSelectionList & list ) const

Description

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.

Arguments

  • component the component to be converted
  • list a selection list where the plug should be added

bool MPxSurfaceShape:: match ( const MSelectionMask & mask, const MObjectArray & componentList ) const

Description

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.

Arguments

  • mask the selection mask to test against
  • componentList a list of components to be tested

Return Value

  • true the match was successfull
  • false the match failed

MPxSurfaceShape::MatchResult MPxSurfaceShape:: matchComponent ( const MSelectionList & item, const MAttributeSpecArray & spec, MSelectionList & list )

Description

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.

Arguments

  • item DAG selection item for the object being matched
  • spec attribute specification object
  • list list to add components to

Return Value

  • The component match result

MObject MPxSurfaceShape:: createFullVertexGroup () const

Description

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.

Return Value

  • A component containing all of the vertices in the shape.

bool MPxSurfaceShape:: deleteComponents ( const MObjectArray & componentList, MDoubleArray & undoInfo )

Description

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.

Arguments

  • componentList List of components to be deleted \itme undoInfo Values used for undo purposes

Return Value

  • true if this method was successful, false otherwise

bool MPxSurfaceShape:: undeleteComponents ( const MObjectArray & componentList, MDoubleArray & undoInfo )

Description

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.

Arguments

  • componentList List of components that were deleted \itme undoInfo Values used for undo purposes

Return Value

  • true if this method was successful, false otherwise

MObject MPxSurfaceShape:: localShapeInAttr () const

Description

Returns the input attribute of the shape. This method will be called by Maya to determine if the shape has construction history.

Return Value

  • the input attribute

MObject MPxSurfaceShape:: localShapeOutAttr () const

Description

Returns the local output attribute of the shape.

Return Value

  • the output attribute

MObject MPxSurfaceShape:: worldShapeOutAttr () const

Description

Returns the world space output attribute of the shape.

Return Value

  • the world space output attribute

MObject MPxSurfaceShape:: cachedShapeAttr () const

Description

Returns the cached shape attribute of the shape.

Return Value

  • the attribute that stores the cached shape

MObject MPxSurfaceShape:: geometryData () const

Description

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.

Return Value

  • the geometry data of the shape

void MPxSurfaceShape:: closestPoint ( const MPoint & toThisPoint, MPoint & theClosestPoint, double tolerance )

Description

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

Arguments

  • toThisPoint the point to test against
  • theClosestPoint the closest point on your surface
  • tolerance tolerance to use in your calculations

bool MPxSurfaceShape:: pointAtParm ( const MPoint & atThisParm, MPoint & evaluatedPoint )

Description

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.

Arguments

  • atThisParm the parameter to check
  • evaluatedPoint the surface point

Return Value

  • true is a point was found, false otherwise

MPxGeometryIterator *MPxSurfaceShape:: geometryIteratorSetup ( MObjectArray & componentList, MObject & components, bool forReadOnly )

Description

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.

Arguments

  • componentList a list of components to be iterated over
  • components the components to be iterated over
  • forReadOnly specifies whether the iterator is for read-only

Return Value

  • The component match result

bool MPxSurfaceShape:: acceptsGeometryIterator ( bool writeable )

Description

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

Arguments

  • writeable is this component type writable by an iterator

Return Value

  • true the shape can supply an iterator
  • false the shape cannot supply an iterator

bool MPxSurfaceShape:: acceptsGeometryIterator ( MObject & component, bool writeable, bool forReadOnly )

Description

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.

Arguments

  • component the component to test
  • writeable is this component type writable by an iterator
  • forReadOnly is this component type readable by an iterator

Return Value

  • true the shape can supply an iterator
  • false the shape cannot supply an iterator

MObjectArray MPxSurfaceShape:: activeComponents () const

Description

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

Return Value

  • an array of active components

bool MPxSurfaceShape:: hasActiveComponents () const

Description

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

Return Value

  • true there are active components
  • false there are no active components

void MPxSurfaceShape:: childChanged ( MChildChanged state )

Description

This method can be used to trigger the shape to recalculate it's bounding box.

Arguments

  • state the type of change that has occurred

bool MPxSurfaceShape:: isRenderable () const

Description

Returns true if the shape is a renderable shape. Making a shape renderable allows the shape to have shading group assignments.

Arguments

  • true the shape is renderable
  • flase the shape is not renderable

void MPxSurfaceShape:: setRenderable ( bool flag )

Description

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

Arguments

  • flag true if the shape is to be renderable, false otherwise

MMatrix MPxSurfaceShape:: getWorldMatrix ( MDataBlock &block, unsigned int instanceGeom ) const

Description

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

Arguments

  • block a MDataBlock
  • instanceGeom the instance this MPxSurfaceShape corresponds to

Direct child classes:

- MPxComponentShape

Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright