//
// This example illustrates how to remove discontinuities of more than 180 from a rotation fcurve
// Create a new scene
NewScene(null, false);
// Create a null
oNull = Application.GetPrim("Null");
// Get the posx parameter of the null
oRotX = oNull.rotx
// Create array of time-value pairs
aKeys = new Array( 0, 0.0, 1, 190.0, 2, 370.0 );
// Create an empty FCurve
oFCurve = oRotX.AddFCurve2( null, siStandardFCurve );
// Set the fcurve keys
oFCurve.SetKeys( aKeys );
Application.LogMessage( 'Before MakeRotationsContinuous:', siInfo );
for (var i = 0; i < oFCurve.Keys.Count; i++)
{
Application.LogMessage( 'Time: ' + oFCurve.Keys(i).Time + ', Value: ' + oFCurve.Keys(i).Value, siInfo );
}
oFCurve.MakeRotationsContinuous();
Application.LogMessage( 'After MakeRotationsContinuous:', siInfo );
for (var i = 0; i < oFCurve.Keys.Count; i++)
{
Application.LogMessage( 'Time: ' + oFCurve.Keys(i).Time + ', Value: ' + oFCurve.Keys(i).Value, siInfo );
}
// Produces the following output:
//
//INFO : Before MakeRotationsContinuous:
//INFO : Time: 0, Value: 0
//INFO : Time: 1, Value: 190
//INFO : Time: 2, Value: 370
//INFO : After MakeRotationsContinuous:
//INFO : Time: 0, Value: 0
//INFO : Time: 1, Value: -170
//INFO : Time: 2, Value: 10 |