class MnCloth

Jump to documentation

(OpenMayaFX) (OpenMayaFX.py)

public members:

MnCloth ()
virtual ~MnCloth ()
MStatus createNCloth ()
MStatus setTopology (const int numFaces, int * numVertsPerFace, int * faces, const int numEdges, int * edges )
MStatus setPositions (const MFloatPointArray & positions,bool startFrame = true)
MStatus setVelocities (const MFloatPointArray & velocities)
MStatus setBendRestAngleFromPositions (const MFloatPointArray & positions)
MStatus setLinksRestLengthFromPositions (const MFloatPointArray & positions)
MStatus setInputMeshAttractPositions (const MFloatPointArray & positions)
MStatus setInputMeshAttractDamping (float damping)
MStatus setInputMeshAttractAndRigidStrength (float * inputAttractArray,float * rigidArray,float * deformArray)
MStatus setComputeRestLength ( const bool b )
MStatus setComputeRestAngles ( const bool b )
MStatus setThickness (float radius)
MStatus setThickness (float * radius)
MStatus setInverseMass (float invMass)
MStatus setInverseMass (float * invMass)
MStatus setBounce (float bounce)
MStatus setBounce (float * bounce)
MStatus setFriction (float friction)
MStatus setFriction (float * friction)
MStatus setDamping (float damping)
MStatus setDamping (float * damping)
MStatus setSelfCollisionFlags (const bool vertToVert, const bool vertToEdge = false, const bool vertToFace = false, const bool edgeToEdge = false, const bool edgeToFace = false)
MStatus setCollisionFlags (const bool vertToVert, const bool edgeToEdge = false, const bool faceToFace= false)
MStatus setDisableGravity ( const bool b )
MStatus setMaxIterations (const int it)
MStatus setMaxSelfCollisionIterations (const int it)
MStatus setSelfCollisionSoftness (float softness)
MStatus setSelfTrappedCheck (bool on)
MStatus setSelfCrossoverPush (float val)
MStatus setDragAndLift (float drag,float lift)
MStatus setTangentialDrag (float tangentialDrag)
MStatus setStartPressure (float startPressure)
MStatus setSealHoles (bool seal)
MStatus setPressure (float pressure)
MStatus setTrackVolume (bool track)
MStatus setIncompressibility (float v)
MStatus setPressureDamping (float damp)
MStatus setPumpRate (float pump)
MStatus setAirTightness (float airTightness)
MStatus setAddCrossLinks (float addCrossLinks)
MStatus setBendAngleDropoff (float dropoff)
MStatus setShearResistance (float resistance)
MStatus setStretchAndCompressionResistance (float stretchResist,float compressionResist)
MStatus setStretchAndCompressionResistance (float * stretchResist,float * compressionResist)
MStatus setBendAngleScale (float scale)
MStatus setRestitutionAngle (float angle)
MStatus setRestitutionTension (float tension)
MStatus setSelfCollideWidth (float width)
MStatus setBendResistance (float strength)
MStatus getNumVertices (unsigned int & numVerts) const
MStatus getPositions ( MFloatPointArray & positions) const
MStatus getVelocities ( MFloatPointArray & velocities) const

Documentation

Class for wrapping N cloth objects
Description

// This class wraps the internal Maya representation of N cloth objects suitable // for use with the Nucleus solver.

Functions

MnCloth:: MnCloth ()

Description

Default constructor. The instance is set to contain nothing.

void MnCloth:: setNCloth (TnCloth * nObj,bool own)

Description

Sets the TnCloth pointer which this class wraps. If own is true, then the TnCloth will be deleted when this class is destroyed.

MStatus MnCloth:: createNCloth ()

Description

Creates the underlying Maya TnCloth and sets this class to wrap it.

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: getNumVertices (unsigned int & numVerts) const

Description

Returns the number of vertices in the underlying n Cloth

MStatus MnCloth:: getPositions ( MFloatPointArray & positions) const

Description

gets the positions of the points of the underlying N Object.

Arguments

  • positions - the array will be filled with the positions.

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setPositions (const MFloatPointArray & positions,bool startFrame)

Description

Sets the positions of the vertices of the underlying N cloth object

Arguments

  • positions - the array containing the position information
  • startFrame - whether this information represents the state of the object at the start frame.

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setVelocities (const MFloatPointArray & velocities)

Description

Sets the velocities of the vertices of the underlying Ncloth object

Arguments

  • velocities - the array containing the velocity information

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setBendRestAngleFromPositions (const MFloatPointArray & positions)

Description

Sets the the bend rest angle from the list of positions for the underlying N Object This sets the shape that bend resistance is trying to achieve.

Arguments

  • velocities - the array containing the posiition information

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setLinksRestLengthFromPositions (const MFloatPointArray & positions)

Description

Sets the the rest length from the list of positions for the underlying N Object. This sets the shape that the stretch/compression resistance are trying to achieve.

Arguments

  • velocities - the array containing the posiition information

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setInputMeshAttractPositions (const MFloatPointArray & positions)

Description

Sets the positions for input mesh attract

Arguments

  • velocities - the array containing the posiition information

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setInputMeshAttractDamping (float damping)

Description

Defines how springy the effect of Input Mesh Attract is. At a value of zero input mesh attract will behave like a spring connection from the input mesh to the output dynamic mesh. The cloth will tend to wiggle about the input mesh position. As the Input Attract Damp is increased to 1 the cloth mesh will still move to the input mesh position but not have the momentum to travel past it, so will no longer occillate about the input position.

Arguments

  • damping - the damping value

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setComputeRestLength ( const bool b )

Description

Sets whether rest lengths will be automatically computed, or overridden manually. If this is set to false, then you must call setLinksRestLengthFromPositions() to set the rest lengths.

Arguments

  • b - whether to compute rest lengths

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setComputeRestAngles ( const bool b )

Description

Sets whether rest angles will be automatically computed, or overridden manually. If this is set to false, then you must call setBendRestAngleFromPositions() to set the rest lengths.

Arguments

  • b - whether to compute rest angles

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: getVelocities ( MFloatPointArray & velocities) const

Description

gets the velocities of the points of the underlying N cloth object.

Arguments

  • velocities - the array will be filled with the positions.

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setTopology (const int numFaces, int * numVertsPerFace, int * faces, const int numEdges, int * edges )

Description

sets the topology of the underlying N Object. Before calling other methods, this must be the first method you call once the cloth object is created.

Arguments

  • numFaces - number of faces
  • numVertsPerFace - an array of size numFaces, where each element describes the number of verts on that face
  • faces - an array containing the actual face description. Each element is a vertex index.
  • numFaces - number of edges
  • edges - an array containing the edge description. Each element is a vertex index.

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setThickness (float radius)

Description

sets a radius on each point of the mesh for collision purposes. The bigger the radius/thickness, the more easily things collide.

Arguments

  • radius - the radius to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setThickness (float * radius)

Description

sets a radius (thickness) on a per point basis for the mesh for collision purposes. The bigger the radius, the more easily things collide.

Arguments

  • radius - the radius to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setInverseMass (float invMass)

Description

sets the mass for every point in this mesh

Arguments

  • invMass - the inverse of the mass. A value of 0 means an infinitely heave object.

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setInverseMass (float * invMass)

Description

sets the mass on a per point basis in this mesh

Arguments

  • invMass - the inverse of the mass. A value of 0 means an infinitely heave object.

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setBounce (float bounce)

Description

sets the bounce for every point in this mesh

Arguments

  • bounce - value of bounce to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setBounce (float * bounce)

Description

sets the bounce on a per point basis in this mesh

Arguments

  • bounce - value of bounce to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setFriction (float friction)

Description

sets the friction for every point in this mesh

Arguments

  • friction - the friction to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setFriction (float * friction)

Description

sets the friction on a per point basis for this mesh

Arguments

  • friction - the friction to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setDamping (float damping)

Description

sets the damping for every point in this mesh

Arguments

  • damping - the damping value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setDamping (float * damping)

Description

sets the on a per point basis in this mesh

Arguments

  • damping - the damping value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setSelfCollisionFlags (const bool vertToVert, const bool vertToEdge, const bool vertToFace, const bool edgeToEdge, const bool edgeToFace)

Description

Sets how (or if) this object will collide with itself.

Arguments

  • vertToVert - whether to calculate vertex - vertex collisions
  • vertToEdge - whether to calculate vertex - edge collisions
  • vertToFace - whether to calculate vertex - face collisions
  • edgeToEdge - whether to calculate edge - edge collisions
  • edgeToFace - whether to calculate edge - face collisions

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setCollisionFlags (const bool vertToVert, const bool edgeToEdge, const bool faceToFace)

Description

Sets how (or if) this object will collide with other objects.

Arguments

  • vertToVert - whether to calculate vertex - vertex collisions
  • edgeToEdge - whether to calculate edge - edge collisions
  • faceToFace - whether to calculate face - face collisions

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setDisableGravity ( const bool b )

Description

Sets whether gravity will affect this object

Arguments

  • b - whether to calculate gravity

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setMaxIterations (const int it)

Description

Sets the number of iterations the solver will perform on various dynamic properties like drag, damping, stretch and bend. Higher iterations take longer, and the primary use of this attribute is to keep things from locking up should high iteration values be requested.

Arguments

  • it - number of iterations

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setMaxSelfCollisionIterations (const int it)

Description

Sets the number of iterations the solver will perform for self collisions on this object.

Arguments

  • it - number of iterations

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setSelfCollisionSoftness (float softness)

Description

This allows one to lower the repulsive force of self collisions such that some interpenetration within the collide width is allowed. This can in some cases reduce jitter due to self collision with low selfCollideIterations. In general its use should be avoided, however.

Arguments

  • softness - value to set.

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setSelfTrappedCheck (bool on)

Description

This tracks self collision crossovers and attempts to push the crossed over points back. It assumes that the surface is in a good state at the start and attempts to preserve that relative state. It is useful in cases where cloth can get caught between passive objects than interpenetrate (for example an elbow passing through a chest). Rather than get stuck on the wrong side this allows the cloth to push back to the correct side when the passive objects later separate.

Arguments

  • on - whether to turn on self trapped check.

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setSelfCrossoverPush (float val)

Description

See node documentation.

Arguments

  • val - value for crossover push

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setDragAndLift (float drag,float lift)

Description

Sets the drag and lift values for the cloth

Arguments

  • drag - value of drag
  • lift - value of lift

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setTangentialDrag (float tangentialDrag)

Description

Sets the tangential drag values for the cloth. Defines the component of drag tangent to the surface. With a value of zero a flat plane will slice through air with no resistance and only have drag when moving along its normal axis. With a value of 1.0 the effect of drag will be equal in all directions.

Arguments

  • tangentialDrag - the tangential drag

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setStartPressure (float startPressure)

Description

With the volume tracking pressure method this defines the relative air pressure inside the object at the startframe.

Arguments

  • startPressure - the start pressure

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setSealHoles (bool seal)

Description

When the volume tracking pressure method is used this determines if physical holes in the cloth model are treated as being capped or not. If holes are not sealed, then air can escape out them, which also has the effect of pushing the cloth. For example, this can simulate a rubber balloon that is suddenly released. It also allows for inflow based on motion of the cloth. The opening in a parachute will allow air to flow in as it falls down, causing sideways pressure that inflates it. Note that drag alone cannot achieve this sort of effect

Arguments

  • seal - whether to seal holes

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setPressure (float pressure)

Description

Sets the pressure within the cloth. This defines a force applied along the surface normal direction

Arguments

  • pressure - the value of pressure to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setTrackVolume (bool track)

Description

Arguments

  • track - whether to track volume

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setIncompressibility (float v)

Description

When the volume tracking pressure model is used this defines how incompressible the internal volume of fluid is. This also will affect how much force is applied to the cloth when air is pumped in. In the case of a balloon higher values of incompressibility will overcome higher stretch resistance. Note that higher incompressibility may require more calculation time.

Arguments

  • v - how incompressible the cloth is

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setPressureDamping (float damp)

Description

Sets the damping value for pressure

Arguments

  • damp - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setPumpRate (float pump)

Description

Defines the rate at which air pressure is added to the object

Arguments

  • pump - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setAirTightness (float airTightness)

Description

Defines the rate at which air can escape from the object, or how permiable the surface is. This is in addition to any physical holes in the model, which can be be capped or not using the seal holes method.

Arguments

  • airTightness - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setAddCrossLinks (float addCrossLinks)

Description

For faces with more than 3 vertices this will create additional stretch and bends links such that each vertex is connected to each other vertex. If this is off then the links will exactly match the meshes list of edges. For a quad meshes having addCrossLinks off would allow the cloth to shear, unless shear resistance was used.

Arguments

  • addCrossLinks - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setBendAngleDropoff (float dropoff)

Description

Defines the way bend resistance changes with the angle. At higher values the bend will resist more at high angles then when the surface is nearly flat.

Arguments

  • dropoff - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setShearResistance (float resistance)

Description

Sets the shear resistance. Shear can be thought of as the bend in the plane of the cloth.

Arguments

  • resistance - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setStretchAndCompressionResistance (float stretchResist,float compressionResist)

Description

Stretch Resistance:

Defines the amount that the material will resist stretching when under tension. Large values generally require more computation, so they may result in longer simulation times. Note that the scalingRelation attribute affects how this value is defined. Also one may need to additionally make the both collision iterations on the solver and constraint strength values high to keep stretching low.

Compression Resistance:

Defines the amount that the material will resist compression. Note that sometimes it is useful to have this value be lower than the Stretch Resistance, because the mesh resolution is only an approximation to a true surface, which could possibly fold within the length of a triangle. If one has a rest position for a cloth that is not flat and the compression and stretch resistance are both high then this can make cloth appear too stiff because the topology locks up. This problem is most noticable when the faces have relatively high angles relative to each other. Having a low compression resistance allows the material keep from locking up, yet still not appear to stretchy. Large values generally require more computation, so they may result in longer simulation times.

Arguments

  • stretchResist - value to set for stretch
  • compressionResist - value to set for compression

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setStretchAndCompressionResistance (float * stretchResist,float * compressionResist)

Description

Sets the stretch and compression resistance for the mesh on a per vertex basis

Arguments

  • stretchResist - value to set for stretch
  • compressionResist - value to set for compression

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setBendAngleScale (float scale)

Description

Defines the amount by which the rest state of the bend angle is scaled.

Arguments

  • scale - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setRestitutionAngle (float angle)

Description

Defines how far we can bend across an edge before it will fail to go back to the rest angle when there are no forces acting on the cloth.

Arguments

  • scale - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setRestitutionTension (float tension)

Description

How far can the links be stretched before they fail to go back to their rest length when there are no forces acting on the cloth. When the tension is greater than the defined value the defined rest length will increase until the tension is equal this value. For very low values the material will pull apart like taffy, yet still resist stretching under mild forces.

Arguments

  • tension - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setSelfCollideWidth (float width)

Description

Sets the self collision width

Arguments

  • width - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setBendResistance (float strength)

Description

Bend resistance measures the amount of attraction to the restAngle, which is defined between cvs on either side of an edge. Larger values will tend to make the surface more rigid and will take longer to compute.

Arguments

  • strength - value to set

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MStatus MnCloth:: setInputMeshAttractAndRigidStrength (float * inputAttractArray,float * rigidArray,float * deformArray)

Description

Sets on a per particle basis, the amount by which each particle is affected by the input mesh attract, rigidity, and deformability. High values for the input mesh attract will make points stick closely to the input mesh. High values for the rigidArray will make the object behave like a rigid body.

These arguments actually encode 2 pieces of information in 1. It contains instructions for:

A) The number of iterations and B) The strength of the effect

The number of iterations is the maximum value over the array passed in. The relative strength, measured from 0 to 1, is the normalized value of each element of the array.

For example, if for the inputAttractArray one were to specify a value of 10.0 for the first element, and 1.0 for the rest, it means that the solver should take 10 steps to compute inputMeshAttract, and the first particle has a strength of 1 while the rest have a strength of 0.1.

Arguments

  • inputAttractArray - values for the input mesh attract
  • rigidArray - values for rigidity
  • deformArray - values for deformability

Return Value

  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed

MnCloth:: ~MnCloth ()

Description

The class destructor.

This class has no child classes.


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