XSIFactory.CreateFCurveKeyCollection

Introduced

v6.0

Description

Creates an empty FCurveKey collection. With an empty FCurveKeyCollection, you can add FCurveKeys with the FCurveKeyCollection.Add method, as long as they belong to the same FCurve.

Scripting Syntax

oReturn = XSIFactory.CreateFCurveKeyCollection();

Return Value

FCurveKeyCollection

Examples

JScript Example

// 
// This example illustrates how to create an empty FCurveKeyCollection and populate it
// 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 );
// Create an empty key collection
aKeyColl = XSIFactory.CreateFCurveKeyCollection();
// Add every other key to the collection
for (var i = 0; i < oFCurve.Keys.Count; i+=2) 
{
        aKeyColl.Add( oFCurve.Keys(i) );
}
// Print out the collection
for (var i = 0; i < aKeyColl.Count; i++) 
{
        Application.LogMessage( 'Time: ' + aKeyColl(i).Time + ', Value: ' + aKeyColl(i).Value, siInfo );
}
// Produces the following output:
//
//INFO : Time: 0, Value: 5
//INFO : Time: 2, Value: 7
//INFO : Time: 4, Value: 9

See Also

FCurveKey FCurveKeyCollection