FCurveKeyCollection.Add

導入

v6.0

詳細

既存のコレクションにFCurveKeyを追加します。キーがコレクションの他のキーと同じFCurveにあり、コレクションにまだ追加されていない場合は、そのキーはコレクションに追加されます。キーのインデックスが戻されるか、キーがコレクションに追加されていない場合は-1になります。FCurveKeyCollection はソートされたコレクションです(キーはパラメータで昇順にソートされています)。

スクリプト 構文

oLong = FCurveKeyCollection.Add( Key );

戻り値

Long

パラメータ

パラメータ タイプ 詳細
キー FCurveKey このコレクションに追加するキー

JScript の例

// 
// This example illustrates how to add a key to an existing FCurveKeyCollection.
// Create a new scene
NewScene(null, false);
// Create a null
oNull = Application.GetPrim("Null");
// Get the posx parameter of the null
oPosX = oNull.posx
// Create array of time-value pairs
aKeys = new Array( 0.00, 5.00,
                                1.00, 6.00,
                                2.00, 7.00,
                                3.00, 8.00,
                                4.00, 9.00,
                                5.00, 10.00 );
// Create an empty FCurve
oFCurve = oPosX.AddFCurve2( null, siStandardFCurve );
// Set the fcurve keys
oFCurve.SetKeys( aKeys );
// Get an empty key collection
var keys = XSIFactory.CreateFCurveKeyCollection();
// Add first and last keys to the new collection
keys.Add( oFCurve.Keys(oFCurve.Keys.Count-1) );
keys.Add( oFCurve.Keys(0) );
// Print out the contents of the collection
for (var i = 0; i < keys.Count; i++) 
{
        Application.LogMessage( 'Time: ' + keys(i).Time + ', Value: ' + keys(i).Value, siInfo );
}
// Produces the following output:
//
//INFO : Time: 0, Value: 5
//INFO : Time: 5, Value: 10

関連項目

FCurveKeyCollection.AddItems FCurveKeyCollection.Remove FCurveKeyCollection.RemoveAt