FCurveKeyCollection.AddItems

Introduced

v6.0

Description

Adds an FCurveKeyCollection to an existing collection. The keys will be added to the collection if they belong to the same FCurve as the other keys in the collection. Any keys in the input collection that are already present in the existing collection will be ignored.

Note: FCurveKeyCollection is maintained in sorted order by parameter so new keys will be inserted at the proper location according to their parameter values.

C# Syntax

FCurveKeyCollection.AddItems( FCurveKeyCollection in_pVal );

Scripting Syntax

FCurveKeyCollection.AddItems( Keys );

Parameters

Parameter Type Description
Keys FCurveKeyCollection Keys to add to this collection

Examples

JScript Example

// 
// This example illustrates how to add keys 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 two key collections
var keys = oFCurve.GetKeysBetween( 4, 5 );
var keys2 = oFCurve.GetKeysBetween( 0, 1 );
// Merge the two collections
keys.AddItems( keys2 );
// 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: 1, Value: 6
//INFO : Time: 4, Value: 9
//INFO : Time: 5, Value: 10

See Also

FCurveKeyCollection.Add FCurveKeyCollection.Remove FCurveKeyCollection.RemoveAt