pymel.core.nodetypes.Expression

Inheritance diagram of Expression

class Expression(*args, **kwargs)

class counterpart of mel function expression

This command describes an expression that belongs to the current scene. The expression is a block of code of unlimited length with a C-like syntax that can perform conversions, mathematical operations, and logical decision making on any numeric attribute(s) in the scene. One expression can read and alter any number of numeric attributes. Theoretically, every expression in a scene can be combined into one long expression, but it is recommended that they are separated for ease of use and editing, as well as efficiency.If this command is being sent by the command line or in a script, then the user should be sure to embed escaped newlines (n), tabs (t) for clarity when reading them in the expression editor. Also, quotes in an expression must be escaped (”) so that they are not confused by the system as the end of your string. When using the expression editor, these characters are escaped for you unless they are already within quotes.Note, expressions that alter or use per-particle attributes of a particle shape should use the ‘dynExpression’ command.

UnitConversion = Enum( EnumValue('UnitConversion', 0, 'all'), EnumValue('UnitConversion', 1, 'none'), EnumValue('UnitConversion', 2, 'angularOnly'))
evaluate()

Evaluate this expression and return the result.

Return type:float list

Derived from api method maya.OpenMaya.MFnExpression.evaluate

getAlwaysEvaluate(**kwargs)

If this is TRUE (the default), then the expression will be evaluated whenever time changes regardless of whether the other inputs have changed, and an output is requested. If it is FALSE, then the expression will only be evaluated if one or more of the inputs changes and an output is requested. Note, if ‘time’ or ‘frame’ are inputs, then the expression will act as if this was set to TRUE.

Derived from mel command maya.cmds.expression

getAnimated(**kwargs)

Derived from mel command maya.cmds.expression

getAttribute(**kwargs)

Derived from mel command maya.cmds.expression

getDefaultObject()

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.

Return type:PyNode

Derived from api method maya.OpenMaya.MFnExpression.getDefaultObject

getExpression()

Gets the expression string for this expression node.

Return type:unicode

Derived from api method maya.OpenMaya.MFnExpression.expression

getName(**kwargs)

Sets the name of the dependency graph node to use for the expression

Derived from mel command maya.cmds.expression

getObject(**kwargs)

Sets the “default” object for the expression. This allows the expression writer to not type the object name for frequently-used objects. See the examples below.

Derived from mel command maya.cmds.expression

getShortNames(**kwargs)

When used with the -q/query flag, tells the command to return the expression with attribute names as short as possible. The default is to return the FULL attribute name, regardless of how the user entered it into the expression, including the object names. With this flag set, attribute names are returned as their short versions, and any attribute that belongs to the default object, if there is one specified, will not display the object’s name.

Derived from mel command maya.cmds.expression

getString(**kwargs)

Set the expression string

Derived from mel command maya.cmds.expression

getUnitConversion()

Get the unit conversion status for the expression node.

Return type:Expression.UnitConversion

Derived from api method maya.OpenMaya.MFnExpression.unitConversion

isAnimated()

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

Return type:bool

Derived from api method maya.OpenMaya.MFnExpression.isAnimated

setAlwaysEvaluate(val=True, **kwargs)

If this is TRUE (the default), then the expression will be evaluated whenever time changes regardless of whether the other inputs have changed, and an output is requested. If it is FALSE, then the expression will only be evaluated if one or more of the inputs changes and an output is requested. Note, if ‘time’ or ‘frame’ are inputs, then the expression will act as if this was set to TRUE.

Derived from mel command maya.cmds.expression

setAnimated(value=False)

Sets the way in which the expression is evaluated.

Parameters :
value : bool

sets the objects evaluation type

Derived from api method maya.OpenMaya.MFnExpression.setAnimated

setAttribute(val=True, **kwargs)

Derived from mel command maya.cmds.expression

setDefaultObject(object)

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

Parameters :
object : PyNode

the object to be set

Derived from api method maya.OpenMaya.MFnExpression.setDefaultObject

setExpression(expression)

Sets the expression string for this expression node.

Parameters :
expression : unicode

The expression string

Derived from api method maya.OpenMaya.MFnExpression.setExpression

setName(val=True, **kwargs)

Sets the name of the dependency graph node to use for the expression

Derived from mel command maya.cmds.expression

setObject(val=True, **kwargs)

Sets the “default” object for the expression. This allows the expression writer to not type the object name for frequently-used objects. See the examples below.

Derived from mel command maya.cmds.expression

setShortNames(val=True, **kwargs)

When used with the -q/query flag, tells the command to return the expression with attribute names as short as possible. The default is to return the FULL attribute name, regardless of how the user entered it into the expression, including the object names. With this flag set, attribute names are returned as their short versions, and any attribute that belongs to the default object, if there is one specified, will not display the object’s name.

Derived from mel command maya.cmds.expression

setString(val=True, **kwargs)

Set the expression string

Derived from mel command maya.cmds.expression

setUnitConversion(conversion)

Set the unit conversion options for the expression node.

Parameters :
conversion : Expression.UnitConversion

unit conversion state for this node

values: ‘all’, ‘none’, ‘angularOnly’

Derived from api method maya.OpenMaya.MFnExpression.setUnitConversion

Previous topic

pymel.core.nodetypes.ExplodeNurbsShell

Next topic

pymel.core.nodetypes.ExtendCurve

Core

Core Modules

Other Modules

This Page