FCurve.Resample

導入

v3.0

詳細

F カーブを再サンプリングします。startframe から endframe まで、step で定義される間隔でキーを追加します。

有効な範囲は、次のように定義されています。

StartFrame < EndFrame でステップ < 0.25 * (EndFrame - StartFrame)

注: F カーブがロックされている場合、または間隔内にあるキーがロックされている場合、メソッドにより「Access Denied」(E_ACCESSDENIED)というエラーが示されます。

キーのロックは、OverrideKeyLock 引数を使用して上書きできます。

C#構文

FCurve.Resample( Object in_StartFrame, Object in_EndFrame, Double in_Step, Boolean in_KeepExistingKeys, Boolean in_OverrideKeyLock );

スクリプト構文

FCurve.Resample( [StartFrame], [EndFrame], [Step], [KeepExistingKeys], [OverrideKeyLock] );

パラメータ

パラメータ タイプ 説明
StartFrame Variant 再サンプリングを開始する時間(フレーム)

デフォルト値:F カーブの最初のキーフレーム。キーがない場合は、playcontrol の In フレーム値

EndFrame Variant 再サンプリングを終了する時間(フレーム)

デフォルト値:最後のキーフレーム。キーがない場合は、playcontrol の Out フレーム値

Step Double 各キーの間隔(フレーム)

デフォルト値: 1

KeepExistingKeys Boolean 再サンプリングされる範囲内のキーを削除しません。

デフォルト値: false

OverrideKeyLock Boolean 範囲内に存在するキーのFCurveKey.Locked値を上書きし、KeepExistingKeys引数が false に設定されている場合は既存のキーを削除します。

デフォルト値: false

JScript の例

/*

	This JScript examples illustrates how to the FCurve.Resample method

	to add a predetermined number of keys to an fcurve.

*/

// 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 a number of keys

var nbkeys = 100;

var arraysize = nbkeys * 2;

var keys = new Array( 2 * nbkeys );

var i = 0, offset = -50;

// Generate some key data with a random distribution

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

{

	v = Math.round( offset + Math.random() * 100 );

	keys[i] = v;

	keys[i+1] = v;

}

keys.sort();

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

{

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

}

// Set the keys onto the fcurve

fc.SetKeys( keys );

// Add the same keys to posy for comparision

nullobj.posy.AddFCurve().SetKeys( keys );

var empty;

// Resample the entire fcurve on posx and disregard the

// existing keys

fc.Resample( empty, empty, 5 );

LogMessage( "original curve : " + nullobj.posy.Source.GetNumKeys() 

	+ " resampled curve : " + nullobj.posx.Source.GetNumKeys() );

// The resampling method can also be used to add keys 

// to a empty fcurve

nullobj.posz.AddFCurve().Resample( -50,50 );

// Outputs:

//INFO : original curve : 64 resampled curve : 21

関連項目

FCurve.AddKey FCurve.RemoveKeys FCurve.GetNumKeys FCurve.Smooth FCurve.Fit