FCurve.RemoveKey

Introduced

v3.0

Description

Removes the key at the specified frame.

Note: If the fcurve is locked then the method raises an 'Access Denied' (E_ACCESSDENIED) error. Key locks can be overridden using the OverrideKeyLock argument.

C# Syntax

FCurve.RemoveKey( Object in_Frame, Double in_Tolerance, Boolean in_OverrideKeyLock );

Scripting Syntax

FCurve.RemoveKey( [Frame], [Tolerance], [OverrideKeyLock] );

Parameters

Parameter Type Description
Frame Variant (valid key time) Time in frames at which to remove key

Default Value: Current Time

Tolerance Double Key tolerance.

Default Value: -1

Possible Values:

Description:

>0 Matches key between Frame - Tolerance and Frame + Tolerance
0 Key must be exactly at frame
-1 Nearest 0.5 frame
OverrideKeyLock Boolean Override the FCurveKey.Locked value to force key to be removed.

Default Value: False

Examples

JScript Example

/*

	This JScript example illustrates how to remove keys from an fcurve. The resample 

	method is used to create the initial keys then the RemoveKey method is used to 

	remove every other key 

*/

// Create a null

Application.NewScene( "", false );

var nullobj = ActiveSceneRoot.AddNull();

// Create an fcurve on the posx parameter from the null

var fc = nullobj.posx.AddFCurve()

// Define the number of keys

var nbkeys = 100 

// Create a key on each frame

fc.Resample();

// Remove every other key

var startframe = fc.GetKeyFrame(0)

var endframe = fc.GetKeyFrame( fc.GetNumKeys()-1 );

// Start editing the fcurve

fc.BeginEdit();

for ( i=startframe; i<=endframe; i+=2 )

{

	fc.RemoveKey(i);

}

// End editing the fcurve and put the undo event onto 

// the undo/redo stack

fc.EndEdit();

See Also

FCurve.AddKey FCurve.RemoveKeyAtIndex FCurve.RemoveKeysAtIndex FCurve.RemoveKeys