Creates and connects an FCurve to this parameter. This method
differs from the Parameter.AddFCurve method in that only the key
value array and function curve type are required as arguments. The key value array
contains the key frame and value only, the tangents are calculated automatically.
If no type argument is specified, then the type of fcurve added will be based on the
parameter's type (which is configured in the parameter's definition). You can override
the default fcurve type associated with a parameter by adding the SPDL attribute
'FCurveType = Standard;' or 'FCurveType = Integer;'.
By default standard fcurves will be created for parameters of type: siDouble, siFloat,
siInt4, siInt2, siByte, siUInt4, siUInt2 and siUByte (see siVariantType
for further details on types). If the parameter represents a boolean, then a boolean
fcurve will be created.
FCurve Parameter.AddFCurve2( Object in_KeyValueArray, Object in_Type ); |
oReturn = Parameter.AddFCurve2( [KeyValueArray], [Type] ); |
Parameter | Type | Description |
---|---|---|
KeyValueArray | Variant | The array may be a 1- or 2-dimensional array. For 2 dimensional arrays the first dimension must define the key values. The key value consists of the key time (in frames) and the key value ( in value units ). For bezier fcurves the tangents will be calculated automatically. |
Type | siFCurveType |
The type of the FCurve. Default Value: defined by parameter type |
/* This example demonstrates how to set up and populate an fcurve using the z-position values from an animation fcurve created by setting keys on a null. The newly created z-position fcurve is then applied to a sphere's z-position. */ NewScene(null, false); // Get a null and animate it. var oRoot = Application.ActiveProject.ActiveScene.Root; var oNull = oRoot.AddPrimitive("Null"); SaveKey(oNull + ".kine.local.posx", 1); SaveKey(oNull + ".kine.local.posy", 1); SaveKey(oNull + ".kine.local.posz", 1); SetValue("PlayControl.Current", 50); Translate(oNull, -14, 0.5, -12, siRelative, siView, siObj, siXYZ); SaveKey(oNull + ".kine.local.posx", 50); SaveKey(oNull + ".kine.local.posy", 50); SaveKey(oNull + ".kine.local.posz", 50); // Loop through the animation and store the z values into a key array for AddFCurve2 (aZKeys). var oPosVector = XSIMath.CreateVector3(); var aZKeys = new Array(50 * 2+1); for ( i=0; i<=50; i++ ) { var oCurrentTransform = oNull.Kinematics.Global.Transform(i); oCurrentTransform.GetTranslation(oPosVector); aZKeys[i*2] = i; aZKeys[i*2+1] = oPosVector.z; } // Now get a sphere and place the FCurves on it. var oSphere = oRoot.AddGeometry("Sphere", "MeshSurface"); oSphere.Kinematics.Global.Parameters("posz").AddFCurve2(aZKeys); |