#include <MPxComponentShape.h>
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.
Public Member Functions | |
virtual void | transformUsing (const MMatrix &matrix, const MObjectArray &componentList) |
Transform the given components using the specified transformation matrix. More... | |
virtual void | transformUsing (const MMatrix &mat, const MObjectArray &componentList, MPxSurfaceShape::MVertexCachingMode cachingMode, MPointArray *pointCache) |
Transform the given components using the specified transformation matrix. More... | |
virtual void | componentToPlugs (MObject &component, MSelectionList &list) 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 MObject | createFullVertexGroup () const |
This method is used to create a component containing every vertex/CV in the object. More... | |
virtual MObject | localShapeInAttr () const |
Returns the input attribute of the shape, which are the control points. More... | |
MVectorArray * | getControlPoints () |
Extract the control points from the data block and store them locally. More... | |
MStatus | setControlPoints (MVectorArray *cps) |
Push the given control points into the node's data block. More... | |
Public Member Functions inherited from MPxSurfaceShape | |
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 | 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 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 | 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 | 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 MPxGeometryIterator * | geometryIteratorSetup (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... | |
Additional Inherited Members | |
Public Types inherited from MPxSurfaceShape | |
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... | |
Static Public Member Functions inherited from MPxSurfaceShape | |
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 inherited from MPxSurfaceShape | |
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 | |
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... | |
|
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.
[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.
|
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.
[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.
|
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.
[in] | component | the component to be converted |
[in] | list | a selection list where the plug should be added |
Reimplemented from MPxSurfaceShape.
|
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.
[in] | mask | the selection mask to test against |
[in] | componentList | a list of components to be tested |
Reimplemented from MPxSurfaceShape.
|
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.
Reimplemented from MPxSurfaceShape.
|
virtual |
Returns the input attribute of the shape, which are the control points.
Reimplemented from MPxSurfaceShape.
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.
[in] | cps | the control points to use |