RemoveAnimation

Description

Removes animation (fcurves, expressions,constraints) from the specified parameters. You can also specify what the value of the parameter will be after removing the animation using this command.

By default, the new value is set to the value of the parameter at the current frame. However, if the Frame argument is specified, the command takes the value from the parameter value at the specified frame to set the new value. Note: In the case of constraints the constraints will be removed from all the parameters its affecting not only from the specified parameters.

Scripting Syntax

RemoveAnimation( [InputObjs], [Time], [StaticFCurves], [BaseAnimation], [LayerAnimation], [SourceMask] );

Parameters

Parameter Type Description
InputObjs String List of animatable parameters (for example "cone*/kine.local.pos").

Default Value: Currently selected and marked parameters

Time Double The animated values at this frame are assigned to the parameters when the animation is removed.

Default Value: Current frame

StaticFCurves Boolean If True the command will remove static (constant) fcurves only.

Default Value: False

BaseAnimation Boolean If True the command will remove animation on the base layer.

Default Value: True

LayerAnimation Boolean If True the command will remove animation on all layers except the base layer.

Default Value: True

SourceMask siSourceType Type of animation source to remove.

Default Value: siAnySource

Examples

VBScript Example

'

' This example sets up some animation on an object on both

' the X and Y positions. Then it demonstrates two different 

' ways to remove the replace the animation while removing it:

' first by passing a specific frame; and then by using the

' (default) current frame.

'

NewScene , false

' Create the object on which to set an 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

printInfo oDonut & ".kine.local.posx", Array( 1 ), "before"

SaveKey oDonut & ".kine.local.posx", 1, -30

printInfo oDonut & ".kine.local.posx", Array( 1 ), "after"

' Set another key frame at frame 100, with XPos = 30

printInfo oDonut & ".kine.local.posx", Array( 100 ), "before"

SaveKey oDonut & ".kine.local.posx", 100, 30

printInfo oDonut & ".kine.local.posx", Array( 100 ), "after"

' 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

' Remove the YPos expression and freeze Y at the value of 

' the animation expression at frame 53

printInfo oDonut & ".kine.local.posy", Array( 1,50,53,100 ), "before"

RemoveAnimation oDonut & ".kine.local.posy", 53

printInfo oDonut & ".kine.local.posy", Array( 1,50,53,100 ), "after"

' Set current frame to 50

SetValue "PlayControl.Current", 50

' Remove XPos fcurve and freeze X at the value of the 

' fcurve at the current frame (frame 50)

printInfo oDonut & ".kine.local.posx", Array( 1,50,53,100 ), "before"

RemoveAnimation oDonut & ".kine.local.posx" 

printInfo oDonut & ".kine.local.posx", Array( 1,50,53,100 ), "after"		

' This is a convenience function for printing out the info easily

function printInfo( in_parameter, in_frame, in_loc )

	LogMessage "-----"

	for each f in in_frame

		LogMessage in_parameter & " parameter at frame " & f & " " _

					& in_loc & " updating = " & GetValue( in_parameter, f )

	next

end function

' Output of above script:

' INFO : -----

' INFO : torus.kine.local.posx parameter at frame 1 before updating = 0

' INFO : -----

' INFO : torus.kine.local.posx parameter at frame 1 after updating = -30

' INFO : -----

' INFO : torus.kine.local.posx parameter at frame 100 before updating = -30

' INFO : -----

' INFO : torus.kine.local.posx parameter at frame 100 after updating = -30

' INFO : -----

' INFO : torus.kine.local.posy parameter at frame 1 before updating = -5

' INFO : torus.kine.local.posy parameter at frame 50 before updating = -0.593575239181519

' INFO : torus.kine.local.posy parameter at frame 53 before updating = 2.80044293403625

' INFO : torus.kine.local.posy parameter at frame 100 before updating = 5

' INFO : -----

' INFO : torus.kine.local.posy parameter at frame 1 after updating = 2.80044293403625

' INFO : torus.kine.local.posy parameter at frame 50 after updating = 2.80044293403625

' INFO : torus.kine.local.posy parameter at frame 53 after updating = 2.80044293403625

' INFO : torus.kine.local.posy parameter at frame 100 after updating = 2.80044293403625

' INFO : -----

' INFO : torus.kine.local.posx parameter at frame 1 before updating = -30

' INFO : torus.kine.local.posx parameter at frame 50 before updating = -0.45452999539318

' INFO : torus.kine.local.posx parameter at frame 53 before updating = 2.27079487869202

' INFO : torus.kine.local.posx parameter at frame 100 before updating = 30

' INFO : -----

' INFO : torus.kine.local.posx parameter at frame 1 after updating = -0.454529995393187

' INFO : torus.kine.local.posx parameter at frame 50 after updating = -0.454529995393187

' INFO : torus.kine.local.posx parameter at frame 53 after updating = -0.454529995393187

' INFO : torus.kine.local.posx parameter at frame 100 after updating = -0.454529995393187

See Also

Parameter.Disconnect AddFCurve RemoveAllAnimation SaveKey RemoveKey NextKey PrevKey FirstKey LastKey