Adds an expression to one or more parameters and then opens the Expression
Editor. This is a combination command (ie., it's the equivalent of using
SetExpr and then EditExpr). You can
disable it from appearing by setting the DisableAutoInspect parameter
to True.
An expression is a string of characters that may include object and
parameter names, mathematical operators, and tokens representing
functions or constants. For example, to constrain object A's Y rotation
to object B's X translation, you would set an expression on
A.kine.local.roty consisting of the string B.kine.local.posx.
An expression is a mathematical formula that you can use to control any
parameter that can be animated, such as translation, rotation, scaling,
material, or texture. You can create almost any connection you like between
parameters, from simple "A = B" relationships to very complex ones using
predefined variables, standard math functions, random number generators,
and more.
For more information on expressions, see the Animation guide.
AddExpr( [InputObj], [ExprStr], [DisableAutoInspect] ); |
Parameter | Type | Description |
---|---|---|
InputObj | String |
List of parameters (for example "cone*/kine.local.pos"). Default Value: Currently selected and marked parameters |
ExprStr | String |
An expression. Default Value: Current parameter value (for example, "a.kine.global.posx = 3.5") |
DisableAutoInspect | Boolean |
True to prevent the Expression Editor from appearing automatically. Default Value: False |
' ' This example sets an expression on a parameter using the AddExpr command ' without inspecting the new expression in the Expression Editor. ' ' Create the object on which to set the expression set oDonut = CreatePrim( "Torus", "NurbsSurface" ) ' Make sure the last frame will be set to 100 SetValue "PlayControl.Out", 100 ' Set a key frame at frame 1, with XPos = -30 SaveKey oDonut & ".kine.local.posx", 1, -30 ' Set another key frame at frame 100, with XPos = 30 SaveKey oDonut & ".kine.local.posx", 100, 30 ' Animate the YPos parameter with an expression AddExpr oDonut & ".kine.local.posy", _ "5*sin(" & oDonut & ".kine.local.posx * 15)", True |