FCurve.GetKey

Introduced

v3.0

Description

Returns the key at the specified frame. If the key doesn't exist then the method raises an E_FAIL error.

C# Syntax

FCurveKey FCurve.GetKey( Object in_Frame, Double in_Tolerance );

Scripting Syntax

oReturn = FCurve.GetKey( Frame, [Tolerance] );

Return Value

FCurveKey

Parameters

Parameter Type Description
Frame Variant The key time in frames at which to look for the key.
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

Examples

JScript Example

/*
	This JScript example illustrates how to add keys to an fcurve and
	then how to access the key using its frame number.
*/
// Create a null
Application.NewScene( null, 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;
// Start editing the fcurve
fc.BeginEdit();
// Add keys to the fcurve
var key, val, frame;
for ( frame=1; frame<=nbkeys; frame++ )
{
	val = ( Math.sin( 1/(frame) ) * 10 ) 
	fc.AddKey( frame, val );
	// Get key using frame
	key = fc.GetKey( frame );
	// Lock key
	key.Locked = true;
}
// End editing the fcurve and put the undo event onto 
// the undo/redo stack
fc.EndEdit();

See Also

FCurve.KeyExists FCurve.Keys FCurve.GetKeyAtIndex FCurve.GetKeyFrame FCurve.GetKeyValue FCurve.GetKeyIndex