MFnExpression Class Reference
[OpenMaya - API module for common classesFunctionSet classes]

#include <MFnExpression.h>
Inheritance diagram for MFnExpression:
Inheritance graph
[legend]
Collaboration diagram for MFnExpression:
Collaboration graph
[legend]

List of all members.


Detailed Description

Expression function set.

This class is used to create, edit, and query expression nodes.


Public Types

enum   UnitConversion { kAll, kNone, kAngularOnly }
  Unit conversion modes. More...

Public Member Functions

virtual MFn::Type  type () const
  Function set type.
virtual  ~MFnExpression ()
  Destructor.
  MFnExpression ()
  Default constructor.
  MFnExpression (MObject &object, MStatus *ReturnStatus=NULL)
  Constructor.
MObject  create (const MString &expression, MObject &object=MObject::kNullObj, MStatus *ReturnStatus=NULL)
MString  expression (MStatus *ReturnStatus=NULL)
MStatus  setExpression (const MString &expression)
MStatus  getDefaultObject (MObject &object)
MStatus  setDefaultObject (MObject &object)
bool  isAnimated (MStatus *ReturnStatus=NULL)
MStatus  setAnimated (bool value=false)
MStatus  evaluate (MDoubleArray &result)
UnitConversion  unitConversion (MStatus *ReturnStatus=NULL) const
MStatus  setUnitConversion (UnitConversion conversion)
  MFnExpression (const MObject &object, MStatus *ReturnStatus=NULL)
  Constructor.
MStatus  getExpression (MString &expression)
  NO SCRIPT SUPPORT.

Protected Member Functions

virtual const char *  className () const
  Class name.

Member Enumeration Documentation

Unit conversion modes.

Enumerator:
kAll  Convert all units.
kNone  Do not do any unit conversion.
kAngularOnly  Only convert angular units.

Constructor & Destructor Documentation

MFnExpression::MFnExpression ( MObject object,
MStatus ReturnStatus = NULL  
)

Constructor.

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

Parameters:
[in]  object  The MObject to attach the function set to
[out]  ReturnStatus  the return status
Status Codes:

MFnExpression::MFnExpression ( const MObject object,
MStatus ReturnStatus = NULL  
)

Constructor.

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

Parameters:
[in]  object  The MObject to attach the function set to
[out]  ReturnStatus  the return status
Status Codes:

Member Function Documentation

MFn::Type MFnExpression::type (  )  const [virtual]

Function set type.

Return the class type : MFn::kExpression

Reimplemented from MFnDependencyNode.

const char * MFnExpression::className (  )  const [protected, virtual]

Class name.

Return the class name : "MFnExpression"

Reimplemented from MFnDependencyNode.

MObject MFnExpression::create ( const MString expression,
MObject object = MObject::kNullObj,
MStatus ReturnStatus = NULL  
)

This method creates and returns a dependency node for a given expression.

A default object can be specified, but if it is not specified in the expression string then the expression string values will be used.

If the expression string is of the form "objectName.attribute = ... " then the default object parameter is not needed. If you supply a default object in this case, then it will be ignored.

If the expression has no default object then you must supply one. For example, if the expression is of the form "attribute = ...", then you must supply a default object.

Parameters:
[in]  expression  The expression string
[in]  object  The default object (optional - see above)
[out]  ReturnStatus  Status code
Returns:
The expression node
Status Codes:

MString MFnExpression::expression ( MStatus ReturnStatus = NULL  ) 

Gets the expression string for this expression node.

Parameters:
[out]  ReturnStatus  Status code. See below.
Returns:
The expression string
Status Codes:

MStatus MFnExpression::setExpression ( const MString expression  ) 

Sets the expression string for this expression node.

Parameters:
[in]  expression  The expression string
Returns:
Status Code
Status Codes:

MStatus MFnExpression::getDefaultObject ( MObject object  ) 

Gets the "default" object for the expression. Not all expressions have a default object. If there is no default object for the expression, the object will be set to MObject::kNullObject and the return status will indicate success. This is a completely legal case that the calling code should check for before blindly using the returned object.

Parameters:
[out]  object  storage for the default object
Returns:
Status Code
Status Codes:

MStatus MFnExpression::setDefaultObject ( MObject object  ) 

Sets the "default" object for the expression. This allows the expression writer to not type the object name for frequently-used objects.

This method will only work for expression strings in which the object name is not specified.

Parameters:
[in]  object  the object to be set
Returns:
Status Code
Status Codes:

bool MFnExpression::isAnimated ( MStatus ReturnStatus = NULL  ) 

If this is true, then the expression will be evaluated whenever time changes, regardless of whether the other inputs have changed.

If it is false (the default) , then the expression will only be evaluated if one or more of the inputs change.

Note, if 'time' or 'frame' are inputs, then the expression will act as if this was set to true.

Parameters:
[out]  ReturnStatus  Status code
Returns:
  • true expression will be evaluated whenever time changes
  • false
Status Codes:

MStatus MFnExpression::setAnimated ( bool  value = false  ) 

Sets the way in which the expression is evaluated.

If this is true, then the expression will be evaluated whenever time changes, regardless of whether the other inputs have changed.

If it is false (the default) , then the expression will only be evaluated if one or more of the inputs change.

Note, if 'time' or 'frame' are inputs, then the expression will act as if this was set to true.

Parameters:
[in]  value  sets the objects evaluation type
Returns:
Status Code
Status Codes:

MStatus MFnExpression::evaluate ( MDoubleArray result  ) 

Evaluate this expression and return the result.

Parameters:
[out]  result  the value of the expression
Returns:
Status code
Status Codes:

MFnExpression::UnitConversion MFnExpression::unitConversion ( MStatus ReturnStatus = NULL  )  const

Get the unit conversion status for the expression node.

Parameters:
[out]  ReturnStatus  Status code
Returns:
The unit conversion state for this node
Status Codes:

MStatus MFnExpression::setUnitConversion ( UnitConversion  conversion  ) 

Set the unit conversion options for the expression node.

Parameters:
[in]  conversion  unit conversion state for this node
Returns:
Status code
Status Codes:

MStatus MFnExpression::getExpression ( MString expression  ) 

NO SCRIPT SUPPORT.

Gets the expression string for this expression node.

Python Notes

This method is not supported in Python. Please see the one which returns a string

Parameters:
[in]  expression  The expression string
Returns:
Status code
Status Codes:

Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6