FCurve.KeyExists

FCurve.KeyExists

導入

v3.0

詳細

指定されたフレームにキーが存在する場合は、True を戻します。

C#構文

Boolean FCurve.KeyExists( Object in_Frame, Double in_Tolerance );

スクリプト構文

oBoolean = FCurve.KeyExists( Frame, [Tolerance] );

戻り値

Boolean

パラメータ

パラメータ タイプ 説明
Frame Variant キーを検索する時間(フレーム)
Tolerance Double キーの許容範囲

デフォルト値: -1

指定可能な値:

説明:

>0 Frame ‐ Tolerance と Frame + Tolerance のキーを合わせます。
0 キーは正確にフレームの位置にある必要があります
-1 最も近い 0.5 フレーム

JScript の例

/*

	This JScript example illustrates how to use the FCurve.KeyExists method

	to find keys on an fcurve.

*/

// 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 some random keys

var nbkeys = 10;

var arraysize = nbkeys * 2;

var keys = new Array( 2 * nbkeys );

var i = 0, empty;

offset = -50;

for ( i=0; i<arraysize; i+=2 )

{

	keys[i] = offset + Math.random() * 100 ;

	keys[i+1] = Math.cos( Math.random() ) * 10;

}

keys.sort();

// Set the keys on the fcurve

fc.SetKeys( keys );

// Find the random keys

for ( i=-50; i<50; i++ )

{

	if ( fc.KeyExists(i) )

	{

		LogMessage( "found key near frame " + i );

	}

	var ckeys = fc.GetNumKeys( i - 0.5, i + 0.5 )

	if ( ckeys > 1 )

	{

		LogMessage( "found "+ ckeys + " keys around frame " + i );

	}

}

// Outputs:

//INFO : found key near frame -21

//INFO : found key near frame -20

//INFO : found key near frame -7

//INFO : found key near frame -6

//INFO : found key near frame -5

//INFO : found key near frame -4

//INFO : found 2 keys around frame -4

//INFO : found key near frame -3

//INFO : found key near frame -2

//INFO : found key near frame 5

//INFO : found key near frame 6

//INFO : found key near frame 7

//INFO : found key near frame 8

//INFO : found key near frame 9

//INFO : found key near frame 10

関連項目

FCurve.GetKey