ScaleKeys (FCurve)
Introduced
6.0
Description
Scales fcurve keys in time or value by a relative amount. The scaling amount is relative to the keyframe bounding box and the anchor point so that a value of 0.5 would scale the keys by 50%.
Note: If the KeyCollection is from a different fcurve then the method will raise an 'Invalid argument' (E_INVALIDARG) error.
If the FCurve is locked then the method raises an 'Access Denied' (E_ACCESSDENIED) error.
Scripting Syntax
FCurve.ScaleKeys( KeyCollection, [FrameFactor], [ValueFactor], [FrameAnchor], [ValueAnchor], [Ripple] )
C# Syntax
FCurve.ScaleKeys( FCurveKeyCollection in_Keys, Double in_FrameFactor, Double in_ValueFactor, Object in_FrameAnchor, Object in_ValueAnchor, Boolean in_Ripple );Parameters
|
Parameter |
Type |
Description |
|
KeyCollection |
The keys to offset. |
|
|
FrameFactor |
The relative amount to scale the fcurve's time. Default Value: 1.0 |
|
|
ValueFactor |
The relative amount to scale the fcurve's value. Default Value: 1.0 |
|
|
FrameAnchor |
The center point for frame scaling. Default Value: 0.0 |
|
|
ValueAnchor |
The center point for value scaling. Default Value: 0.0 |
|
|
Ripple |
If true then keys before the first and after the last key in KeyCollection will be offset to maintain their distance from the scaled keys Default Value: False |
Examples
JScript Example
// // This example illustrates how to scale some fcurve keys by 50%. // 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 ); Application.LogMessage( 'Before Scaling:', siInfo ); for (var i = 0; i < oFCurve.Keys.Count; i++) { Application.LogMessage( 'Time: ' + oFCurve.Keys(i).Time + ', Value: ' + oFCurve.Keys(i).Value, siInfo ); } oFCurve.ScaleKeys( oFCurve.GetKeysBetween( 2, 4 ), 0.5, 0.5, 3.0, 7.5, false ); Application.LogMessage( 'After Scaling:', 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 Scaling: //INFO : Time: 0, Value: 5 //INFO : Time: 1, Value: 6 //INFO : Time: 2, Value: 7 //INFO : Time: 3, Value: 8 //INFO : Time: 4, Value: 9 //INFO : Time: 5, Value: 10 //INFO : After Scaling: //INFO : Time: 0, Value: 5 //INFO : Time: 1, Value: 6 //INFO : Time: 2.5, Value: 7.25 //INFO : Time: 3, Value: 7.75 //INFO : Time: 3.5, Value: 8.25 //INFO : Time: 5, Value: 10
See Also
Autodesk Softimage v7.5