Public Types | Public Member Functions | Protected Member Functions

MFnExpression Class Reference

Search for all occurrences

Detailed Description

Expression function set.

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

#include <MFnExpression.h>

Inheritance diagram for MFnExpression:
Inheritance graph
[legend]

List of all members.

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)
 This method creates and returns a dependency node for a given expression.
MString expression (MStatus *ReturnStatus=NULL)
 Gets the expression string for this expression node.
MStatus setExpression (const MString &expression)
 Sets the expression string for this expression node.
MStatus getDefaultObject (MObject &object)
 Gets the "default" object for the expression.
MStatus setDefaultObject (MObject &object)
 Sets the "default" object for the expression.
bool 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.
MStatus setAnimated (bool value=false)
 Sets the way in which the expression is evaluated.
MStatus evaluate (MDoubleArray &result)
 Evaluate this expression and return the result.
UnitConversion unitConversion (MStatus *ReturnStatus=NULL) const
 Get the unit conversion status for the expression node.
MStatus setUnitConversion (UnitConversion conversion)
 Set the unit conversion options for the expression node.
 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 ( MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

Parameters:
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
MFnExpression ( const MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

Parameters:
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:

Member Function Documentation

MFn::Type type ( ) const [virtual]

Function set type.

Return the class type : MFn::kExpression.

Reimplemented from MFnDependencyNode.

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

Class name.

Return the class name : "MFnExpression".

Reimplemented from MFnDependencyNode.

MObject 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]expressionThe expression string
[in]objectThe default object (optional - see above)
[out]ReturnStatusStatus code
Returns:
The expression node
Status Codes:
MString expression ( MStatus ReturnStatus = NULL)

Gets the expression string for this expression node.

Parameters:
[out]ReturnStatusStatus code. See below.
Returns:
The expression string
Status Codes:
MStatus setExpression ( const MString expression)

Sets the expression string for this expression node.

Parameters:
[in]expressionThe expression string
Returns:
Status Code
Status Codes:
MStatus 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]objectstorage for the default object
Returns:
Status Code
Status Codes:
MStatus 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]objectthe object to be set
Returns:
Status Code
Status Codes:
bool 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]ReturnStatusStatus code
Returns:
  • true expression will be evaluated whenever time changes
  • false
Status Codes:
MStatus 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]valuesets the objects evaluation type
Returns:
Status Code
Status Codes:
MStatus evaluate ( MDoubleArray result)

Evaluate this expression and return the result.

Parameters:
[out]resultthe value of the expression
Returns:
Status code
Status Codes:
MFnExpression::UnitConversion unitConversion ( MStatus ReturnStatus = NULL) const

Get the unit conversion status for the expression node.

Parameters:
[out]ReturnStatusStatus code
Returns:
The unit conversion state for this node
Status Codes:
MStatus setUnitConversion ( UnitConversion  conversion)

Set the unit conversion options for the expression node.

Parameters:
[in]conversionunit conversion state for this node
Returns:
Status code
Status Codes:
MStatus 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]expressionThe expression string
Returns:
Status code
Status Codes:

MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression
MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression MFnExpression