class MClothControl

Jump to documentation

Access to cloth data

public members:

MClothControl ()
virtual ~MClothControl ()
static MStatus getUVs ( const MString & cloth, const MString & panel, MDoubleArray & uvs )
static int panelId ( const MString & panel, MStatus * ReturnStatus = NULL )
static MStatus panelFaces ( const MString & panel, MIntArray & faceIds )
static MObject solverNode ( const MString & cloth, MStatus * ReturnStatus = NULL )
static MObject currentSolver ()
static void getClothSystem ( const MObject &solver, MClothSystem *& system, MStatus *ReturnStatus = NULL )
static MObject stitcherNode ( const MString & cloth, MStatus * ReturnStatus = NULL )
static bool isClothMesh ( MDagPath &path, MObject &solver, int &index )
static bool getClothFromSolver ( const MObject &solver, int plugIndex, MObject &cloth )
static bool isSolverCloth ( const MDagPath &cloth, const MString &solverName, MClothSystem *& system, MClothHandle& handle )
static double getPrecedingFrame ( MClothSystem &system, double currentTime, double& precedingTime, MStatus * ReturnStatus = NULL)
static double getSucceedingFrame ( MClothSystem &system, double currentTime, double& succeedingTime, MStatus * ReturnStatus = NULL)
static void loadFrame ( MClothPolyhedron &rigidBody, double frame, int cacheNumber, MStatus * ReturnStatus = NULL)
static double dgTimeGivenClothFrame ( MClothPolyhedron &rigidBody, double frame, MStatus * ReturnStatus = NULL)
static int pinch ( MClothSystem &system, MClothPolyhedron *poly1, unsigned triIndex1, MClothPolyhedron *poly2, unsigned triIndex2, MStatus * ReturnStatus = NULL)
static void externalForces ( MClothSystem &system, MStatus * ReturnStatus = NULL)
static bool solveCB ( MClothSystem &system, double cutoff, double cur, int istep)
static bool collisionCB ( MClothSystem &system, int ipass, double maxp)
static bool stepCB ( MClothSystem &system, double h)
static bool interruptCheckCB ( MClothSystem &system )

Documentation

Access to cloth data
Description

This class provides access to various cloth data. This includes UVs per per cloth, UVs per panel, stitcher node of a cloth, solver node of a cloth, face membership of a panel, etc.

Functions

MClothControl:: MClothControl ()

Description

Class constructor.

MClothControl:: ~MClothControl ()

Description

Class destructor.

MStatus MClothControl:: getUVs ( const MString & cloth, const MString & panel, MDoubleArray & uvs )

Description

Retrieves the UVs of a cloth. If a panel is specified, then this method will return only the UVs of the panel that belongs to that cloth.

Arguments

  • cloth The cloth to query.
  • panel The panel of the cloth to query. If empty, will query entire cloth.
  • uvs A single indexed array of UVs. Indexed by pair. eg. U0,V0,U1,V1,U2,V2,...

Return Value

  • MS::kSuccess UVs were successfully retrieved.
  • MS::kFailure An error occurred. eg. Invalid cloth, Panel does not belong to cloth, etc.

int MClothControl:: panelId ( const MString & panel, MStatus * ReturnStatus )

Description

Returns the panelId of a given panel.

Arguments

  • panel The panel shape to query.
  • ReturnStatus The return status of the method.

Return Value

  • the panel Id of the specified panel, if valid. -1 otherwise.

MStatus MClothControl:: panelFaces ( const MString & panel, MIntArray & faceIds )

Description

Returns the face membership of a given panel via an array of faceIds.

Arguments

  • panel The panel shape to query.
  • faceIds The output array of faceIds.

Return Value

  • MS::kSuccess FaceIds were successfully queried
  • MS::kFailure An error occurred. eg. Panel is invalid.

MObject MClothControl:: solverNode ( const MString & cloth, MStatus * ReturnStatus )

Description

Returns the solver node of the given cloth.

Arguments

  • cloth The cloth to query.
  • ReturnStatus The return status of the method.

Return Value

  • An MObject pointer to the solver node.

MObject MClothControl:: currentSolver ( )

Description

Returns the current solver instance as reported in the Maya UI.

Arguments

None.

Return Value

  • An MObject pointer to the solver node.

void MClothControl:: getClothSystem ( const MObject & node, MClothSystem *&system, MStatus * ReturnStatus )

Description

Given a solver object, allows the user to find the cloth system pointer.

Arguments

  • solver The solver node (MObject)
  • system Pointer to the cloth system. This value could be NULL.
  • ReturnStatus The return status of the method.

Return Value

None.

MObject MClothControl:: stitcherNode ( const MString & cloth, MStatus * ReturnStatus )

Description

Returns the stitcher node of the given cloth, if one exists.

Arguments

  • cloth The cloth to query.
  • ReturnStatus The return status of the method.

Return Value

  • An MObject pointer to the stitcher node.

double MClothControl:: getPrecedingFrame ( MClothSystem &system, double currentTime, double &precedingTime, MStatus * ReturnStatus)

Description

Returns the frame and frame time just preceding the given "currentTime" time.

Arguments

  • system The cloth system to query.
  • currentTime The current time.
  • precedingTime The preceding time reference.
  • ReturnStatus The return status of the method.

Return Value

  • A double frame value .

double MClothControl:: getSucceedingFrame ( MClothSystem &system, double currentTime, double& succeedingTime, MStatus * ReturnStatus)

Description

Returns the frame and frame time just succeeding the given "currentTime" time.

Arguments

  • system The cloth system to query.
  • currentTime The current time.
  • preceedingTime The succeeding time reference.
  • ReturnStatus The return status of the method.

Return Value

  • A double frame value.

void MClothControl:: loadFrame ( MClothPolyhedron &rigidBody, double frame, int cacheNumber, MStatus * ReturnStatus)

Description

Animates rigid body vertices.

Arguments

  • rigidBody The rigid body to animate.
  • frame The frame number.
  • cacheNumber The cache number.
  • ReturnStatus The return status of the method.

double MClothControl:: dgTimeGivenClothFrame ( MClothPolyhedron &rigidBody, double frame, MStatus * ReturnStatus)

Description

Get the dependency graph time for cloth frame.

Arguments

  • rigidBody The rigid body.
  • frame The frame number.
  • ReturnStatus The return status of the method.

Return Value

  • A double dependency graph time.

int MClothControl:: pinch ( MClothSystem &system, MClothPolyhedron *poly1, unsigned triIndex1, MClothPolyhedron *poly2, unsigned triIndex2, MStatus * ReturnStatus)

Description

Determine which of the two given triangles should be given priority in a rigid body collision.

Arguments

  • system The cloth system.
  • poly1 The first rigid body.
  • triIndex1 The contact triangle index for first rigid body.
  • poly2 The second rigid body.
  • triIndex2 The contact triangle index for second rigid body.
  • ReturnStatus The return status of the method.

Return Value

  • If the new triangle has priority (LOW NUMBER) then returns -1, meaning pick the new triangle. If the priority is the same, returns 1, meaning keep the old triangle.

void MClothControl:: externalForces ( MClothSystem &system, MStatus * ReturnStatus)

Description

This will set the accelerations for all constraints, and each particle. Cloth Solver should call this function once per timestep.

Arguments

  • system The cloth system.
  • ReturnStatus The return status of the method.

bool MClothControl:: solveCB ( MClothSystem &cloth, double cutoff, double current, int istep)

Description

This will update the solve status into Maya. Cloth Solver should call this function for linear solution notification.

Arguments

  • system The cloth system.

Return Value

  • false to stop solving, continue solving otherwise.

bool MClothControl:: collisionCB ( MClothSystem &cloth, int ipass, double maxp)

Description

This will update the collision status into Maya. Cloth Solver should call this function for collision notification.

Arguments

  • system The cloth system.

Return Value

  • false to stop solving, continue solving otherwise.

bool MClothControl:: interruptCheckCB ( MClothSystem &cloth )

Description

The Cloth Solver should call this function to check for user interrupts (e.g. the user pressing the ESC key) during long periods of computation.

Arguments

  • system The cloth system.

Return Value

  • true if an interrupt was requested, in which case the current computation in the solver should be aborted. false if no interrupt.

bool MClothControl:: stepCB ( MClothSystem &cloth, double h)

Description

This will update the solve status into Maya. Cloth Solver should call this function for adaptive solution notification.

Arguments

  • system The cloth system.

Return Value

  • false to stop solving, continue solving otherwise.

bool MClothControl:: getClothFromSolver ( const MObject &solverObj, int plug, MObject &clothObj )
Description

Given a solver node and a plug index to the outMesh on the solver node, walks the DG looking for the cloth that belongs to that pair.

Arguments

  • solverObj - MObject pointer to the solver.
  • plugIndex - index number for the outMesh.
  • clothObj - The discovered cloth object.

ReturnCodes

true if a clothObj was successfully found.

This class has no child classes.


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