'
' This example sets an expression on a parameter using the SetExpr
' command and then uses the EditExpr command to open the Expression
' Editor to inspect the new expression.
'
NewScene , false
' 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
' Temporarily disable cycle checking (this
' expression creates a cycle on purpose)
bCyclePref = GetValue( "preferences.data_management.disable_cycle_checking" )
SetValue "preferences.data_management.disable_cycle_checking", True
' Animate the YPos parameter with an expression
SetExpr oDonut & ".kine.local.posy", _
"5*sin(" & oDonut & ".kine.local.posx * 15)"
' Restore cycle checking to its previous value
SetValue "preferences.data_management.disable_cycle_checking", bCyclePref
' Now display the Expression Editor to see the results
EditExpr oDonut & ".kine.local.posy" |