v3.0
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.
FCurve.RemoveKey( [Frame], [Tolerance], [OverrideKeyLock] ); |
| 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
|
||||||||
| OverrideKeyLock | Boolean | Override the FCurveKey.Locked value to force key to
be removed.
Default Value: False |
/*
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();
|