Parameter.AddFCurve2

説明

FCurveを作成し、このパラメータに接続します。Parameter.AddFCurveメソッドとは異なり、引数にはキー値の配列とファンクションカーブのタイプのみが必要となります。キー値の配列にはキーフレームと値のみが含まれ、タンジェントは自動的に計算されます。

型引数を指定しない場合、追加される F カーブはパラメータの型(パラメータの定義で設定)を基準にします。SPDl の属性'FCurveType = Standard;'または'FCurveType = Integer;'を追加することにより、パラメータに関連付けられているデフォルトF カーブタイプを無効にできます。

デフォルトでは、以下のパラメータに対して標準F カーブが作成されます。siDouble、siFloat、siInt4、siInt2、siByte、siUInt4、siUInt2、および SiUByte(これらのタイプについてはsiVariantTypeを参照)。パラメータがブール値で表現される場合は、ブールの F カーブが作成されます。

スクリプト 構文

oReturn = Parameter.AddFCurve2( [KeyValueArray], [Type] );

戻り値

FCurve

パラメータ

パラメータ タイプ 詳細
KeyValueArray Variant 配列には 1D 配列または 2D 配列を使用できます。2D 配列では、最初の次元でキーの値を定義する必要があります。キーの値は、キーの時刻(フレーム)およびキーの値(値単位)で構成されます。ベジェF カーブではタンジェントが自動的に計算されます。
siFCurveType F カーブのタイプ

デフォルト値:パラメータのタイプによって決定

JScript の例

/*
        This example demonstrates how to set up and populate an fcurve 
        using the z-position values from an animation fcurve created
        by setting keys on a null. The newly created z-position fcurve
        is then applied to a sphere's z-position.
*/
NewScene(null, false);
// Get a null and animate it.
var oRoot = Application.ActiveProject.ActiveScene.Root;
var oNull = oRoot.AddPrimitive("Null");
SaveKey(oNull + ".kine.local.posx", 1);
SaveKey(oNull + ".kine.local.posy", 1);
SaveKey(oNull + ".kine.local.posz", 1);
SetValue("PlayControl.Current", 50);
Translate(oNull, -14, 0.5, -12, siRelative, siView, siObj, siXYZ);
SaveKey(oNull + ".kine.local.posx", 50);
SaveKey(oNull + ".kine.local.posy", 50);
SaveKey(oNull + ".kine.local.posz", 50);
// Loop through the animation and store the z values into a key array for AddFCurve2 (aZKeys).
var oPosVector = XSIMath.CreateVector3();
var aZKeys = new Array(50 * 2+1);
for ( i=0; i<=50; i++ )
{
        var oCurrentTransform = oNull.Kinematics.Global.Transform(i);
        oCurrentTransform.GetTranslation(oPosVector);
        aZKeys[i*2] = i;
        aZKeys[i*2+1] = oPosVector.z;
}
// Now get a sphere and place the FCurves on it.
var oSphere = oRoot.AddGeometry("Sphere", "MeshSurface");
oSphere.Kinematics.Global.Parameters("posz").AddFCurve2(aZKeys);

関連項目

Parameter.Source Parameter.AddFCurve