class MFnField

Jump to documentation

: public MFnDagNode Function set for Dynamic Fields (OpenMayaFX) (OpenMayaFX.py)

Inheritance:

MFnField < MFnDagNode < MFnDependencyNode < MFnBase

public members:

MFnField ( const MObject & object, MStatus * ReturnStatus = NULL )
MStatus getForceAtPoint (const MPointArray & point, const MVectorArray & velocity, const MDoubleArray & mass, MVectorArray & force, double deltaTime = 1.0 / 24.0 )
MStatus getForceAtPoint (const MVectorArray & point, const MVectorArray & velocity, const MDoubleArray & mass, MVectorArray & force, double deltaTime = 1.0 / 24.0 )
double magnitude ( MStatus *ReturnStatus = NULL ) const
MStatus setMagnitude ( double mag )
double attenuation ( MStatus *ReturnStatus = NULL ) const
MStatus setAttenuation ( double atten )
double maxDistance ( MStatus *ReturnStatus = NULL ) const
MStatus setMaxDistance ( double maxDist )
bool perVertex ( MStatus *ReturnStatus = NULL ) const
MStatus setPerVertex ( bool enable )
bool useMaxDistance ( MStatus *ReturnStatus = NULL ) const
MStatus setUseMaxDistance ( bool enable )
double falloffCurve ( const double param, MStatus *ReturnStatus = NULL )
bool isFalloffCurveConstantOne ( MStatus *ReturnStatus = NULL)

Inherited from MFnDagNode:

public members:

kNextPos
MObject create ( const MTypeId &typeId, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MTypeId &typeId, const MString &name, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MString &type, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MString &type, const MString &name, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
unsigned int parentCount ( MStatus * ReturnStatus = NULL ) const
MObject parent ( unsigned int i, MStatus * ReturnStatus = NULL ) const
MStatus addChild ( MObject & child , unsigned int index = kNextPos , bool keepExistingParents = false )
MStatus removeChild ( MObject & child )
MStatus removeChildAt ( unsigned int index )
unsigned int childCount ( MStatus * ReturnStatus = NULL ) const
MObject child ( unsigned int i, MStatus * ReturnStatus = NULL ) const
MObject dagRoot ( MStatus * ReturnStatus = NULL )
bool hasParent ( const MObject & node, MStatus * ReturnStatus = NULL ) const
bool hasChild (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool isChildOf (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool isParentOf (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool inUnderWorld ( MStatus * ReturnStatus = NULL ) const
bool inModel ( MStatus * ReturnStatus = NULL ) const
bool isInstanceable ( MStatus * ReturnStatus=NULL ) const
MStatus setInstanceable ( const bool how )
bool isInstanced ( bool indirect = true, MStatus * ReturnStatus = NULL ) const
bool isInstancedAttribute ( const MObject & attr, MStatus * ReturnStatus = NULL ) const
unsigned int instanceCount ( bool total, MStatus * ReturnStatus = NULL ) const
MObject duplicate ( bool instance = false, bool instanceLeaf = false, MStatus * ReturnStatus = NULL ) const
MStatus getPath ( MDagPath & path )
MStatus getAllPaths ( MDagPathArray & paths )
MString fullPathName ( MStatus *ReturnStatus = NULL)
MString partialPathName ( MStatus *ReturnStatus = NULL)
MMatrix transformationMatrix ( MStatus * ReturnStatus = NULL ) const
bool isIntermediateObject ( MStatus * ReturnStatus = NULL ) const
MStatus setIntermediateObject ( bool isIntermediate )
int objectColor ( MStatus * ReturnStatus = NULL ) const
MStatus setObjectColor ( int color )
bool usingObjectColor ( MStatus * ReturnStatus = NULL ) const
MStatus setUseObjectColor ( bool useObjectColor )
MBoundingBox boundingBox ( MStatus * ReturnStatus = NULL ) const
MDagPath dagPath ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( const MDagPath & path )
virtual MStatus setObject ( MObject & object )
MObject model ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( const MObject & object )

Inherited from MFnDependencyNode:

public members:

virtual MFn::Type type () const
enum MAttrClass
kGlobalDynamicAttr
kLocalDynamicAttr
MObject create ( const MTypeId & typeId , MStatus * ReturnStatus = NULL )
MObject create ( const MTypeId & typeId , const MString & name , MStatus * ReturnStatus = NULL )
MObject create ( const MString & type , MStatus * ReturnStatus = NULL )
MObject create ( const MString & type , const MString & name , MStatus * ReturnStatus = NULL )
MTypeId typeId ( MStatus * ReturnStatus = NULL ) const
MString typeName ( MStatus * ReturnStatus = NULL ) const
MString name ( MStatus * ReturnStatus = NULL ) const
MString setName ( const MString & name , MStatus * ReturnStatus = NULL )
MStatus getConnections ( MPlugArray & array ) const
unsigned int attributeCount ( MStatus * ReturnStatus=NULL) const
MObject attribute ( unsigned int index, MStatus * ReturnStatus=NULL) const
MObject reorderedAttribute ( unsigned int index, MStatus * ReturnStatus=NULL) const
MObject attribute ( const MString & attrName, MStatus * ReturnStatus=NULL) const
MAttrClass attributeClass ( const MObject & attr, MStatus * ReturnStatus=NULL) const
MStatus getAffectedAttributes ( const MObject & attr, MObjectArray & affectedAttributes ) const
MStatus getAffectedByAttributes ( const MObject & attr, MObjectArray & affectedByAttributes ) const
MPlug findPlug ( const MObject & attr, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MString & attrName, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MObject & attr, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MString & attrName, MStatus * ReturnStatus=NULL) const
MStatus addAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr )
MStatus removeAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr )
MPxNode * userNode ( MStatus * ReturnStatus=NULL ) const
bool isFromReferencedFile ( MStatus * ReturnStatus=NULL) const
bool isShared ( MStatus * ReturnStatus=NULL) const
bool hasUniqueName ( MStatus * ReturnStatus=NULL) const
MString parentNamespace ( MStatus * ReturnStatus=NULL) const
bool isLocked ( MStatus * ReturnStatus=NULL) const
MStatus setLocked ( bool locked )
static MString classification ( const MString & nodeTypeName )
bool isNewAttribute ( const MObject & attr, MStatus * ReturnStatus=NULL) const
static unsigned int allocateFlag ( const MString pluginName, MStatus * ReturnStatus=NULL )
static MStatus deallocateFlag (const MString pluginName, unsigned int flag)
static MStatus deallocateAllFlags (const MString pluginName)
MStatus setFlag (unsigned int flag, bool state)
bool isFlagSet (unsigned int flag, MStatus * ReturnStatus=NULL) const
bool isDefaultNode ( MStatus * ReturnStatus=NULL) const
MStatus setDoNotWrite ( bool flag )
bool canBeWritten ( MStatus * ReturnStatus=NULL) const
bool hasAttribute (const MString & name , MStatus * ReturnStatus=NULL) const
MObject getAliasAttr (bool force, MStatus * ReturnStatus=NULL)
bool setAlias (const MString & alias,const MString & name , const MPlug & plug, bool add=true, MStatus * ReturnStatus=NULL)
bool findAlias (const MString & alias, MObject & attrObj, MStatus * ReturnStatus=NULL) const
bool getAliasList ( MStringArray & strArray, MStatus * ReturnStatus=NULL)
MString plugsAlias (const MPlug & plug, MStatus * ReturnStatus=NULL)
public
bool getPlugsAlias (const MPlug & plug, MString & aliasName, MStatus * ReturnStatus=NULL)

Inherited from MFnBase:

public members:

virtual MFn::Type type () const
bool hasObj ( MFn::Type ) const
bool hasObj ( const MObject & ) const
MObject object ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( MObject & object )
virtual MStatus setObject ( const MObject & object )

Documentation

Description

Function set for creation, edit, and query of Dynamic Fields.

There are several types of dynamic fields: Air, Drag, Gravity, Newton Radial, Turbulence, Uniform, and Vortex.

Functions

MFnField:: MFnField ()

Description

Default class constructor. The function set is not attached to an MObject.

MFnField:: MFnField ( MObject & object, MStatus * ReturnStatus )

Description

Class constructor that initializes the function set to the given MObject.

Arguments

  • object the MObject to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnField:: MFnField ( const MObject & object, MStatus * ReturnStatus )

Description

Class constructor that initializes the function set to the given constant MObject.

Arguments

  • object the const MObject to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnField:: MFnField ( const MDagPath & object, MStatus * ReturnStatus )

Description

Class constructor that initializes the function set to the given constant MDagPath object.

Arguments

  • object the const MDagPath to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFn::Type MFnField:: type () const

Description

Return the type of this function set.

Return Value

  • the constant MFn::kField

MFnField:: ~MFnField ()

Description

Class destructor.

MStatus MFnField:: getForceAtPoint (const MPointArray & point, const MVectorArray & velocity, const MDoubleArray & mass, MVectorArray & force, double deltaTime)

Description

Compute the force of a field on an array of points, given their position, velocity, and mass. Note that only the Air and Vortex fields require a time increment to compute forces, all other fields will ignore this argument.

This method uses MPointArray to represent the positions of points. If a point instance is in a rational form or a homogenous form, you should reset it to be in the cartesian form P(x, y, z, 1).

Arguments

  • point array of positions for each point.
  • velocity array of velocities for each point.
  • If the length of the velocity array is 0, a velocity of 0.0 is assumed for all the points. Note the velocity array is a requirement for the Air and Drag fields to compute forces.
  • mass array of mass values for each point.
  • If the length of the mass array is 0, a mass of 1.0 is assumed for all the points.
  • force output array of forces applied to each point.
  • If the length of the force array supplied is 0, the array is automatically resized. If the contents of the force array contains data, the computed force is added to the supplied data. This can be useful to accumulate forces of multiple fields.
  • deltaTime time increment in seconds for usage with the Air and Vortex fields.
  • Default is (1.0 / 24.0 fps).

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnField:: getForceAtPoint (const MVectorArray & point, const MVectorArray & velocity, const MDoubleArray & mass, MVectorArray & force, double deltaTime)

Description

Compute the force of a field on an array of points, given their position, velocity, and mass. Note that only the Air and Vortex fields require a time increment to compute forces, all other fields will igonore this argument.

This method uses MVectorArray to represent the positions of a point.

Arguments

  • point array of positions for each point.
  • velocity array of velocities for each point.
  • If the length of the velocity array is 0, a velocity of 0.0 is assumed for all the points. Note the velocity array is a requirement for the Air and Drag fields to compute forces.
  • mass array of mass values for each point.
  • If the length of the mass array is 0, a mass of 1.0 is assumed for all the points.
  • force output array of forces applied to each point.
  • If the length of the force array supplied is 0, the array is automatically resized. If the contents of the force array contains data, the computed force is added to the supplied data. This can be useful to accumulate forces of multiple fields.
  • deltaTime time increment in seconds for usage with the Air and Vortex fields.
  • Default is (1.0 / 24.0 fps).

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

double MFnField:: magnitude ( MStatus * ReturnStatus ) const

Description

Returns the strength of the field.

Arguments

  • ReturnStatus Status code

Return Value

  • A value representing the strength of the field.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnField:: setMagnitude ( double mag )

Description

Sets the strength of the field.

Arguments

  • mag A value representing the strength of the field.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

double MFnField:: attenuation ( MStatus * ReturnStatus ) const

Description

Returns the rate of change where the strength of the field changes as the distance between the field and the affected object increases.

Arguments

  • ReturnStatus Status code

Return Value

  • A positive value representing the exponent for rate of change.
  • A value of 0 and the force remains constant over distance.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnField:: setAttenuation ( double atten )

Description

Sets the rate of change where the strength of the field changes as the distance between the field and the affected object increases.

Arguments

  • atten A positive value representing the exponent for rate of change.
  • A value of 0 and the force remains constant over distance.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

double MFnField:: maxDistance ( MStatus * ReturnStatus ) const

Description

Returns the maximum distance from the field at which the force of the field is exerted. The Use Max Distance setting must be turned on for maximum distance to take effect. The maximum distance is scaled by the falloff curve's non-zero range.

Arguments

  • ReturnStatus Status code

Return Value

  • A value representing distance in internal linear units.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnField:: setMaxDistance ( double dist )

Description

Sets the maximum distance from the field at which the force of the field is exerted. The Use Max Distance setting must be turned on for maximum distance to take effect.

Arguments

  • dist A value representing distance in internal linear units.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnField:: perVertex ( MStatus * ReturnStatus ) const

Description

Returns true if the field exerts its force on each individual point (cv, particle, vertex) equally. Returns false if the force is exerted only from the geometric center of the object or set of points.

Arguments

  • ReturnStatus Status code

Return Value

  • true Force is applied to each individual point.
  • false Force is applied from the geometric center.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnField:: setPerVertex ( bool enable )

Description

Enables the field to exert its force on each individual point (cv, particle, vertex) equally. Otherwise, the force is exerted only from the geometric center of the object or set of points.

Arguments

  • enable Flag to enable or disable individual point forces.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnField:: useMaxDistance ( MStatus * ReturnStatus ) const

Description

Returns true if the field will use the maximum distance setting to determine the area of influence.

Arguments

  • ReturnStatus Status code

Return Value

  • true Field uses the maximum distance setting.
  • false Field ignores the maximum distance setting.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnField:: setUseMaxDistance ( bool enable )

Description

Enables the field to use the maximum distance setting to determine the area of influence.

Arguments

  • enable Flag to enable or disable maximum distance.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnField:: isFalloffCurveConstantOne ( MStatus * ReturnStatus )

Description

Returns true if falloffCurve is a constant one (default) or false if not.

Arguments

  • ReturnStatus Status code

Return Value

  • If falloff curve always returns a constant one

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

double MFnField:: falloffCurve ( const double param, MStatus * ReturnStatus )

Description

Returns falloff given the param in [0,1]. This is enabled if the use the maximum distance is enabled.

Arguments

  • param Parameter
  • ReturnStatus Status code

Return Value

  • The falloff value given the param.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

Direct child classes:

- MFnVortexField
- MFnVolumeAxisField
- MFnUniformField
- MFnTurbulenceField
- MFnRadialField
- MFnNewtonField
- MFnGravityField
- MFnDragField
- MFnAirField

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