## FCurve.RemoveKeysAtIndex

### Introduced

v3.0

### Description

Removes all keys starting at StartIndex and ending at StartIndex + Count.
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.RemoveKeysAtIndex( Int32 in_StartIndex, Int32 in_Count, Boolean in_OverrideKeyLock );

### Scripting Syntax

    FCurve.RemoveKeysAtIndex( StartIndex, Count, [OverrideKeyLock] );

### Parameters

Parameter | Type | Description
--- | --- | ---
StartIndex | Long | The starting key index at which to start removing keys. Note: The key index must be valid (a value between 0 and (number of keys - 1)).
Count | Long. | The number of keys to remove. Note: Valid values can only be between 1 and (number of keys - start index).
OverrideKeyLock | Boolean | Override the FCurveKey.Locked value to force keys to be removed. Default Value: false

### Examples

#### JScript Example

    /*
            This JScript example illustrates how to use the FCurve.RemoveKeysAtIndex method
            to remove keys from the entire curve or interval on the fcurve.
    */
    // Create a null
    Application.NewScene( "", false );
    var nullobj = ActiveSceneRoot.AddNull();
    var empty;
    // Add a custom property set to the null
    var cpset = nullobj.AddCustomProperty( "CustomPSet" );
    var x = cpset.AddParameter( "X", siDouble, empty, siAnimatable, "X", "X", empty, 0.25, 0, 10 );
    var y = cpset.AddParameter( "Y", siInt4, empty, siAnimatable, "Y", "Y", empty, 5, 0, 100 );
    // Create some fcurves
    var fc1 = x.AddFCurve();
    var fc2 = y.AddFCurve();
    // Add keys to the fcurves
    fc1.Resample();
    fc2.Resample();
    // Lock all the keys on fc2
    for ( i=0; i<fc2.GetNumKeys(); i++ )
    {
            key = fc2.GetKeyAtIndex(i);
            key.Locked = true;
    }
    var cKeys = 10, startframe, endframe;
    // Remove 10 keys starting at index 10
    startframe = fc1.GetKeyFrame(10);
    endframe = fc1.GetKeyFrame(10 + cKeys - 1);
    LogMessage( "keys in interval " + startframe + "-" + endframe + " : " + fc1.GetNumKeys(startframe,endframe) );
    fc1.RemoveKeysAtIndex(10,10);
    LogMessage( "keys remaining in interval " + fc1.GetNumKeys( startframe, endframe ) );
    // remove 10 keys starting at index 0 and override the key lock
    startframe = fc2.GetKeyFrame(0);
    endframe = fc2.GetKeyFrame( cKeys-1 );
    LogMessage( "keys in interval " + startframe+"-"+endframe+" : " +  fc1.GetNumKeys(startframe,endframe) );
    fc2.RemoveKeysAtIndex( 0, 10, true );
    LogMessage( "keys remaining in interval " + fc2.GetNumKeys(startframe,endframe) );
    // Outputs:
    //INFO : "keys in interval 11-20 : 10"
    //INFO : "keys remaining in interval 0"
    //INFO : "keys in interval 1-10 : 10"
    //INFO : "keys remaining in interval 0"

### See Also

FCurve.RemoveKey FCurve.RemoveKeyAtIndex FCurve.RemoveKeys