# FCurve Class Reference

Related Scripting Object: FCurve

The FCurve (function curve) class provides access to a set of functions for getting and setting Softimage fcurve attributes, as well as creating, retrieving, modifying and deleting fcurve keys. More...

`#include <xsi_fcurve.h>`

Inheritance diagram for FCurve:

List of all members.

## Public Member Functions
| FCurve ()
| ~FCurve ()
| FCurve (const CRef &in_ref)
| FCurve (const FCurve &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
FCurve & | operator= (const FCurve &in_obj)
FCurve & | operator= (const CRef &in_ref)
CValue::DataType | GetValueType () const
siFCurveType | GetFCurveType (void) const
CStatus | PutFCurveType (siFCurveType in_type)
bool | GetLocked (void) const
CStatus | PutLocked (bool in_value)
bool | GetDependsOnFrameRate (void) const
CStatus | PutDependsOnFrameRate (bool in_value)
CValue | GetNoKeyValue (void) const
CStatus | PutNoKeyValue (const CValue &in_value)
siFCurveExtrapolation | GetExtrapolation (void) const
CStatus | PutExtrapolation (siFCurveExtrapolation in_type)
siFCurveInterpolation | GetInterpolation (void) const
CStatus | PutInterpolation (siFCurveInterpolation in_type)
CValue | GetLowClamp (void) const
CStatus | PutLowClamp (const CValue &in_value)
CValue | GetHighClamp (void) const
CStatus | PutHighClamp (const CValue &in_value)
CValue | Eval (const CTime &in_frame) const
CValue | Eval (const double &in_frame) const
CFCurveKeyRefArray | GetKeys (void) const
CFCurveKeyRefArray | GetKeysBetween (const CTime &in_startframe=CTime(DBL_MAX, CTime::CUSTOM), const CTime &in_endframe=CTime(DBL_MAX, CTime::CUSTOM)) const
bool | GetSelected (void) const
CFCurveKeyRefArray | GetSelectedKeys () const
CStatus | SetKeys (const CTimeArray &in_timearray, const CValueArray &in_valuearray, bool in_keepexistingkeys=false)
CStatus | SetKeys (const CTimeArray &in_timearray, const CDoubleArray &in_valuearray, const CLongArray &in_keyinterpolationarray, const CTimeArray &in_lefttanxarray=CTimeArray(), const CDoubleArray &in_lefttanyarray=CDoubleArray(), const CTimeArray &in_righttanxarray=CTimeArray(), const CDoubleArray &in_righttanyarray=CDoubleArray(), bool in_keepexistingkeys=false)
CStatus | SetKeyTangents (const CDoubleArray &in_array)
bool | GetSI3DStyle (void) const
CStatus | PutSI3DStyle (bool in_value)
LONG | AddKey (const CTime &in_frame, const CValue &in_value, siFCurveKeyInterpolation in_interp=siDefaultKeyInterpolation, double in_ltx=DBL_MAX, double in_lty=DBL_MAX, double in_rtx=DBL_MAX, double in_rty=DBL_MAX, double in_tol=DBL_MAX, bool in_okl=false)
CStatus | Resample (const CTime &in_startframe=CTime(DBL_MAX, CTime::CUSTOM), const CTime &in_endframe=CTime(DBL_MAX, CTime::CUSTOM), double in_step=1, bool in_keepexistingkeys=false, bool in_overridekeylock=false)
CStatus | Smooth (const CTime &in_start=CTime(DBL_MAX, CTime::CUSTOM), const CTime &in_end=CTime(DBL_MAX, CTime::CUSTOM), double in_dFilterSize=5, double in_dSamplingStep=1, siFCurveSmoothFilterType in_filterType=siFCurveAverageFilterType, double in_dGaussianVariance=1)
CStatus | Fit (const CTime &in_start=CTime(DBL_MAX, CTime::CUSTOM), const CTime &in_end=CTime(DBL_MAX, CTime::CUSTOM), double in_dFittingTolerance=0.1)
CStatus | Set (const FCurve &in_fcurve)
CStatus | RemoveKey (const CTime &in_frame, double in_tolerance=DBL_MAX, bool in_overridekeylock=false)
CStatus | RemoveKeyAtIndex (LONG in_index, bool in_overridekeylock=false)
CStatus | RemoveKeysAtIndex (LONG in_index, LONG in_count, bool in_overridekeylock=false)
LONG | RemoveKeys (const CTime &in_startframe=CTime(DBL_MAX, CTime::CUSTOM), const CTime &in_endframe=CTime(DBL_MAX, CTime::CUSTOM), bool in_overridekeylock=false)
bool | KeyExists (const CTime &in_frame, double in_tolerance=DBL_MAX) const
FCurveKey | GetKey (const CTime &in_frame, double in_tolerance=DBL_MAX) const
LONG | GetNumKeys (const CTime &in_startframe=CTime(DBL_MAX, CTime::CUSTOM), const CTime &in_endframe=CTime(DBL_MAX, CTime::CUSTOM)) const
FCurveKey | GetKeyAtIndex (LONG in_index) const
LONG | GetKeyIndex (const CTime &in_frame, double in_tolerance=DBL_MAX) const
CTime | GetKeyTime (LONG in_index) const
CValue | GetKeyValue (LONG in_index) const
CStatus | SetKey (LONG in_index, const CTime &in_frame, const CValue &in_value, bool in_overridekeylock=false)
bool | IsEditing (void) const
CStatus | BeginEdit (void)
CStatus | EndEdit (void)
CStatus | UndoEdit (void)
bool | GetMute (void) const
CStatus | PutMute (bool in_value)
CStatus | Offset (const CTime &in_frameOffset, const CValue &in_valueOffset)
CStatus | OffsetKeys (const CFCurveKeyRefArray &in_Keys, const CTime &in_frameOffset, const CValue &in_valueOffset)
CStatus | Scale (double in_frameFactor, double in_valueFactor, const CTime &in_frameAnchor, const CValue &in_valueAnchor)
CStatus | ScaleKeys (const CFCurveKeyRefArray &in_Keys, double in_frameFactor, double in_valueFactor, const CTime &in_frameAnchor, const CValue &in_valueAnchor, bool in_ripple=false)
CStatus | ExtendCycle (LONG in_CyclesBefore, LONG in_CyclesAfter)
CStatus | SnapToNearestFrame (void)
CStatus | MakeRotationsContinuous (void)
CTime | GetMinKeyFrame (void) const
CTime | GetMidKeyFrame (void) const
CTime | GetMaxKeyFrame (void) const
CValue | GetMinKeyValue (void) const
CValue | GetMidKeyValue (void) const
CValue | GetMaxKeyValue (void) const
bool | InsertKeyAtFrame (const CTime &in_frame)

## Detailed Description

The FCurve (function curve) class provides access to a set of functions for getting and setting Softimage fcurve attributes, as well as creating, retrieving, modifying and deleting fcurve keys.

FCurves can be created and connected to parameters using the Parameter::AddFCurve function. FCurves are supported by the following parameter types: siBool, siDouble, siFloat, siInt4, siInt2, siByte, siByte, siUInt4, siUInt2 and siUByte (see siVariantType for definitions of these types).

Note:
  For more information on interpolation and extrapolation in Softimage, see FCurve Interpolation and Extrapolation

See also:
  Parameter::GetSource, FCurveKey, About FCurves

Example:

              using namespace XSI;
              Application app;
              Model root = app.GetActiveSceneRoot();

              X3DObject myCube;
              root.AddGeometry( L"Cube", L"MeshSurface", L"", myCube );

              // create and connect an fcurve to the position x
              Parameter posx( myCube.GetParameter(L"posx") );

              FCurve fcrv;
              posx.AddFCurve( siUnknownFCurve, fcrv );

              // show the new fcurve type
              siFCurveType fcrvType = fcrv.GetFCurveType();

              CString strFcrvType;

              switch ( fcrvType )
              {
                  case siUnknownFCurve: strFcrvType = L"siUnknownFCurve"; break;
                  case siBooleanFCurve: strFcrvType = L"siBooleanFCurve"; break;
                  case siIntegerFCurve: strFcrvType = L"siIntegerFCurve"; break;
                  case siStandardFCurve: strFcrvType = L"siStandardFCurve"; break;
                  case siRawDataFCurve: strFcrvType = L"siRawDataFCurve"; break;
                  default:
                      strFcrvType = L"Invalid FCurve type";
              }

              app.LogMessage( L"FCurve type : " + strFcrvType );

## Constructor & Destructor Documentation

FCurve | ( |  | ) |

Default constructor.

~FCurve | ( |  | ) |

Default destructor.

FCurve | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  | in_ref | constant reference object.

FCurve | ( | const FCurve & | in_obj | ) |

Copy constructor.

Parameters:

  | in_obj | constant class object.

## Member Function Documentation

bool IsA | ( | siClassID | in_ClassID | ) | const`[virtual]`

Returns true if a given class type is compatible with this API class.

Parameters:

  | in_ClassID | class type.

Returns:
  true if the class is compatible, false otherwise.

Reimplemented from AnimationSource.

siClassID GetClassID | ( |  | ) | const`[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from AnimationSource.

FCurve& operator= | ( | const FCurve & | in_obj | ) |

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:

  | in_obj | constant class object.

Returns:
  The new FCurve object.

FCurve& operator= | ( | const CRef & | in_ref | ) |

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:

  | in_ref | constant class object.

Returns:
  The new FCurve object.

Reimplemented from AnimationSource.

CValue::DataType GetValueType | ( |  | ) | const

Returns the value type of the function curve.

Returns:
  The value type of the fcurve.

siFCurveType GetFCurveType | ( | void |  | ) | const

Returns the function curve's FCurve type (standard, boolean, raw, etc.).

Returns:
  The fcurve type (one of the siFCurveType values).

CStatus PutFCurveType | ( | siFCurveType | in_type | ) |

Sets the function curve's curve type.

Parameters:

  | in_type | Function curve type.

Returns:
  CStatus::OK success

  CStatus::Fail failure

bool GetLocked | ( | void |  | ) | const

Returns true if the function curve is locked.

Returns:
  True if the fcurve is locked

CStatus PutLocked | ( | bool | in_value | ) |

Sets the locked state of the function curve.

Parameters:

  | in_value | new locked state

Returns:
  CStatus::OK success

  CStatus::Fail failure

bool GetDependsOnFrameRate | ( | void |  | ) | const

Returns the fcurve's dependency on the frame rate (time). If the fcurve is set as time-dependent it will adjust when the scene's frame rate changes. Typically you don't want this to be set to true when the fcurve is a profile curve that does not use time as a factor.

Animation fcurves are typically time-dependent; that is, they generally represent change in a parameter's value over time (for example, a change in an object's X position from frame 10 to frame 90).

Profile fcurves usually do not use frame values on either axis. Profile fcurves are used in deformations to allow a user to fine-tune an effect (for example, the Bulge operator uses percentage of amplitude on the Y-axis over distance from the deformation center on the X-axis).

Returns:
  True if the fcurve X axis represents time

Since:
  5.0

CStatus PutDependsOnFrameRate | ( | bool | in_value | ) |

Sets the fcurve's dependency on the frame rate (time). If the fcurve is set as time-dependent it will adjust when the scene's frame rate changes. Typically you don't want this to be set to true when the fcurve is a profile curve that does not use time as a factor.

Animation fcurves are typically time-dependent; that is, they generally represent change in a parameter's value over time (for example, a change in an object's X position from frame 10 to frame 90).

Profile fcurves usually do not use frame values on either axis. Profile fcurves are used in deformations to allow a user to fine-tune an effect (for example, the Bulge operator uses percentage of amplitude on the Y-axis over distance from the deformation center on the X-axis).

Parameters:

  | in_value | New time dependency type

Returns:
  CStatus::OK success

  CStatus::Fail failure

Since:
  5.0

CValue GetNoKeyValue | ( | void |  | ) | const

Returns the value of the function curve when there are no keys.

Returns:
  The fcurve value.

CStatus PutNoKeyValue | ( | const CValue & | in_value | ) |

Sets the value of the function curve when there are no keys.

Parameters:

  | in_value | function curve value

Returns:
  CStatus::OK success

  CStatus::Fail failure

siFCurveExtrapolation GetExtrapolation | ( | void |  | ) | const

Returns the extrapolation type of the function curve.

Note:
  For more information on interpolation and extrapolation in Softimage, see FCurve Interpolation and Extrapolation

Returns:
  The fcurve's extrapolation type (one of the siFCurveExtrapolation values).

CStatus PutExtrapolation | ( | siFCurveExtrapolation | in_type | ) |

Sets the extrapolation type of the function curve.

Note:
  For more information on interpolation and extrapolation in Softimage, see FCurve Interpolation and Extrapolation

Parameters:

  | in_type | The fcurve's extrapolation type (one of the siFCurveExtrapolation values).

Returns:
  CStatus::OK success

  CStatus::Fail failure

siFCurveInterpolation GetInterpolation | ( | void |  | ) | const

Returns the interpolation type of a standard function curve.

Note:
  For more information on interpolation and extrapolation in Softimage, see FCurve Interpolation and Extrapolation

Returns:
  The fcurve's interpolation type (one of the siFCurveInterpolation values).

CStatus PutInterpolation | ( | siFCurveInterpolation | in_type | ) |

Sets the interpolation type of a standard function curve.

Note:
  For more information on interpolation and extrapolation in Softimage, see FCurve Interpolation and Extrapolation

Parameters:

  | in_type | The fcurve's interpolation type (one of the siFCurveInterpolation values).

Returns:
  CStatus::OK success

  CStatus::Fail failure

CValue GetLowClamp | ( | void |  | ) | const

Returns the lower-clamping value of the function curve.

Returns:
  The fcurve's lower-clamping value.

CStatus PutLowClamp | ( | const CValue & | in_value | ) |

Sets the lower-clamping value of the function curve.

Parameters:

  | in_value | The fcurve's lower-clamping value.

Returns:
  CStatus::OK success

  CStatus::Fail failure

CValue GetHighClamp | ( | void |  | ) | const

Returns the higher-clamping value of the function curve.

Returns:
  The fcurve's higher-clamping value.

CStatus PutHighClamp | ( | const CValue & | in_value | ) |

Sets the higher-clamping value of the function curve.

Parameters:

  | in_value | The fcurve's higher-clamping value.

Returns:
  CStatus::OK success

  CStatus::Fail failure

CValue Eval | ( | const CTime & | in_frame | ) | const

Evaluates the function curve at a given frame. If the curve is discontinuous, the right limit is returned.

Parameters:

  | in_frame | The frame at which to evaluate the function curve.

Returns:
  The value of the fcurve at a given frame.

CValue Eval | ( | const double & | in_frame | ) | const

Evaluates the function curve at a given frame. If the curve is discontinuous, the right limit is returned.

Parameters:

  | in_frame | The frame at which to evaluate the function curve

Returns:
  The value of the fcurve at a given frame.

CFCurveKeyRefArray GetKeys | ( | void |  | ) | const

Returns an array of FCurveKey objects on the function curve.

Returns:
  Array of references to FCurveKey objects.

CFCurveKeyRefArray GetKeysBetween | ( | const CTime & | in_startframe = `CTime(DBL_MAX, CTime::CUSTOM)`,
|  | const CTime & | in_endframe = `CTime(DBL_MAX, CTime::CUSTOM)` |
| ) |  |  | const

Returns an array of FCurveKey objects on the function curve between the start frame and end frame.

Parameters:

  | in_startframe | The start frame of the range of keys. Defaults to the first key on the curve.
  | in_endframe | The end frame of the range of keys. Defaults to the last key on the curve.

Returns:
  Array of references to FCurveKey objects.

Since:
  6.0

bool GetSelected | ( | void |  | ) | const

Returns the selected state of the function curve.

Returns:
  True if the FCurve is selected; false otherwise.

Since:
  6.0

CFCurveKeyRefArray GetSelectedKeys | ( |  | ) | const

Returns an array of selected FCurveKey objects on the function curve.

Returns:
  Array of references to FCurveKey objects.

Since:
  6.0

CStatus SetKeys | ( | const CTimeArray & | in_timearray,
|  | const CValueArray & | in_valuearray,
|  | bool | in_keepexistingkeys = `false` |
| ) |  |  |

Sets the keys of the function curve, previous keys are discarded if the argument `in_keepexistingkeys` = false.

Parameters:

  | in_timearray | An array of times
  | in_valuearray | An array of values
  | in_keepexistingkeys | (optional--defaults to false)

Returns:
  CStatus::OK success

  CStatus::Fail failure

CStatus SetKeys | ( | const CTimeArray & | in_timearray,
|  | const CDoubleArray & | in_valuearray,
|  | const CLongArray & | in_keyinterpolationarray,
|  | const CTimeArray & | in_lefttanxarray = `CTimeArray()`,
|  | const CDoubleArray & | in_lefttanyarray = `CDoubleArray()`,
|  | const CTimeArray & | in_righttanxarray = `CTimeArray()`,
|  | const CDoubleArray & | in_righttanyarray = `CDoubleArray()`,
|  | bool | in_keepexistingkeys = `false` |
| ) |  |  |

Sets the keys of the function curve, previous keys are discarded if the argument `in_keepexistingkeys` = false. This function can only be used with standard fcurves, since only standard fcurves support key interpolation and key tangents.

The tangents are optional; however, if specified, the auto tangent constraint will be turned off to allow the tangents to be set without modification. This may lead to an invalid curve depending on the tangent values. If you want the tangents to be automatically calculated pass an empty array for each of the tangent values or specify both the x,y values to be `DBL_MAX`.

Parameters:

  | in_timearray | An array of times
  | in_valuearray | An array of values
  | in_keyinterpolationarray | An array of key interpolations
  | in_lefttanxarray | An array of left tan x, time value relative to key time (optional)
  | in_lefttanyarray | An array of left tan y, a value relative to key value (optional)
  | in_righttanxarray | An array of right tan x, a value relative to key value (optional)
  | in_righttanyarray | An array of right tan y (optional)
  | in_keepexistingkeys | (optional--defaults to false)

Returns:
  CStatus::OK success

  CStatus::Fail failure

CStatus SetKeyTangents | ( | const CDoubleArray & | in_array | ) |

Sets the values of the tangency values on both sides of the key value.

Parameters:

  | in_array | An array of tangency values (LeftTanX, LeftTanY, RightTanX, RightTanY). The LeftTanX and RightTanX must be specified in frame units.

Returns:
  CStatus::OK success

  CStatus::Fail failure

bool GetSI3DStyle | ( | void |  | ) | const

Returns true if the fcurve is using the SI3D style of tangent constraints.

Returns:
  true for SI3D tangent constraint style.

CStatus PutSI3DStyle | ( | bool | in_value | ) |

Sets the style of tangent constraints to use. True to use the SI3D style of tangent constraints.

Parameters:

  | in_value | True to use SI3D tangent constraints; false for Softimage tangent constraints.

Returns:
  CStatus::OK success

  CStatus::Fail failure

LONG AddKey | ( | const CTime & | in_frame,
|  | const CValue & | in_value,
|  | siFCurveKeyInterpolation | in_interp = `siDefaultKeyInterpolation`,
|  | double | in_ltx = `DBL_MAX`,
|  | double | in_lty = `DBL_MAX`,
|  | double | in_rtx = `DBL_MAX`,
|  | double | in_rty = `DBL_MAX`,
|  | double | in_tol = `DBL_MAX`,
|  | bool | in_okl = `false` |
| ) |  |  |

Adds a new key at the specified range with the specified value. The tolerance argument can be used to merge all keys within a certain range. The range is defined as `Frame` - `Tolerance` and `Frame` + `Tolerance`. The merged key will inherit the constraints of the nearest key within this range.

Parameters:

  | in_frame | New key frame
  | in_value | New key value
  | in_interp | Key interpolation
  | in_ltx | Left tangent x
  | in_lty | Left tangent y
  | in_rtx | Right tangent x
  | in_rty | Right tangent y
  | in_tol | By default a tolerance of 0.5 frame is specified.
  | in_okl | True to override the key locks

Returns:
  index > 0 (success)

  index == -1 (failure)

See also:
  FCurve::InsertKeyAtFrame

CStatus Resample | ( | const CTime & | in_startframe = `CTime(DBL_MAX, CTime::CUSTOM)`,
|  | const CTime & | in_endframe = `CTime(DBL_MAX, CTime::CUSTOM)`,
|  | double | in_step = `1`,
|  | bool | in_keepexistingkeys = `false`,
|  | bool | in_overridekeylock = `false` |
| ) |  |  |

Resamples the fcurve, adding keys from startframe to endframe at the interval defined by the step argument. A valid range is defined as:

     startframe < endframe and step < 0.25 * ( endframe - startframe )

By default the frame range specified by the playcontrol's `In` and `Out` parameters will be used. A key is created at the start frame and end frame. The number of samples created between these keys is:

     ( endframe - startframe ) / step

Depending on the frame rate there may be a rounding error with the last key resulting in an extra key being created at the end.

Parameters:

  | in_startframe | The start frame of the range to resample
  | in_endframe | The end frame of the range to resample
  | in_step | Step
  | in_keepexistingkeys | True to keep existing keys in resample range
  | in_overridekeylock | True to override the key locks

Returns:
  CStatus::OK success

  CStatus::AccessDenied if the fcurve or fcurvekeys are locked

  CStatus::Fail failure

See also:
  FCurve::Smooth,FCurve::Fit

CStatus Smooth | ( | const CTime & | in_start = `CTime(DBL_MAX, CTime::CUSTOM)`,
|  | const CTime & | in_end = `CTime(DBL_MAX, CTime::CUSTOM)`,
|  | double | in_dFilterSize = `5`,
|  | double | in_dSamplingStep = `1`,
|  | siFCurveSmoothFilterType | in_filterType = `siFCurveAverageFilterType`,
|  | double | in_dGaussianVariance = `1` |
| ) |  |  |

Smooths the FCurve in a given time span using a filter by removing sharp spikes and jags from the FCurve by averaging between keys. The FCurve is smoothed first and re-sampled at a sampling step of `in_dSamplingStep`.

Parameters:

  | in_start | The start time of the range to smooth. Must be less than the end time (`in_end` value). Defaults to the first key frame on the fcurve or, if there are no keys, the PlayControl.In frame value.
  | in_end | The end time of the range to smooth. Defaults to the last key frame or, if there are no keys, the PlayControl.Out frame value.
  | in_dFilterSize | Defines the number of keys that are averaged to calculate a new key. A high filter size will yield a much straighter curve. Defaults to `5` and must be greater than `1`.
  | in_dSamplingStep | The sampling step applied to the FCurve after smoothing. Must be less than `in_dFilterSize`. Defaults to `1`.
  | in_filterType | Specifies the type of filter we want to use for smoothing (see siFCurveSmoothFilterType). Defaults to siFCurveAverageFilterType.
  | in_dGaussianVariance | Variance of the Gaussian filter. Controls the degree of smoothing. A higher variance smooths the function curve more. Defaults to `1` and must be greater than `0`.

Returns:
  CStatus::OK success

  CStatus::AccessDenied if the FCurve or FCurveKeys are locked

  CStatus::InvalidArgument One of the argument is invalid.

  CStatus::Fail failure

See also:
  FCurve::Fit,FCurve::Resample

Since:
  5.1

CStatus Fit | ( | const CTime & | in_start = `CTime(DBL_MAX, CTime::CUSTOM)`,
|  | const CTime & | in_end = `CTime(DBL_MAX, CTime::CUSTOM)`,
|  | double | in_dFittingTolerance = `0.1` |
| ) |  |  |

Fits the FCurve within a time span by removing redundant keys while preserving the original shape of a function curve.

Parameters:

  | in_start | The start time of the range to fit. Must be less than the end time (`in_end` value). Defaults to the first key frame on the fcurve or, if there are no keys, the PlayControl.In frame value.
  | in_end | The end time of the range to fit. Defaults to the last key frame or, if there are no keys, the PlayControl.Out frame value.
  | in_dFittingTolerance | Adjusts the closeness of the fit (that is, Maximum distance between the FCurve and the resulting fitted FCurve). Smaller values will respect the original shape of the curve more by using more keys, while larger values will use less keys and result in a fit that deviates from the original curve. Defaults to `0.1` and must be greater than `0`.

Returns:
  CStatus::OK success

  CStatus::AccessDenied if the FCurve or FCurveKeys are locked

  CStatus::InvalidArgument One of the argument is invalid.

  CStatus::Fail failure

See also:
  FCurve::Smooth, FCurve::Resample

Since:
  5.1

CStatus Set | ( | const FCurve & | in_fcurve | ) |

Copies the specified FCurve (source) to this FCurve (target).

Note:
  The operation is undoable. Any pending undo session previously set with FCurve::BeginEdit is automatically ended before copying the FCurve.

Parameters:

  | in_fcurve | The source FCurve to copy.

Returns:
  CStatus::OK success

  CStatus::AccessDenied if the FCurve or FCurveKeys are locked

  CStatus::InvalidArgument The source FCurve is invalid.

  CStatus::Fail Input FCurve type is not compatible. You cannot set an FCurve which is connected to a non-boolean parameter with a boolean FCurve (i.e. siBooleanFCurve).

See also:
  Parameter.AddFCurve

Since:
  5.1

Example:

              using namespace XSI;
              Application app;
              Model root = app.GetActiveSceneRoot();

              X3DObject myCube;
              root.AddGeometry( L"Cube", L"MeshSurface", L"", myCube );

              // Create and connect an fcurve to position X
              Parameter posx( myCube.GetParameter(L"posx") );

              FCurve posxFc;
              posx.AddFCurve( siStandardFCurve, posxFc );

              // Add some keys
              posxFc.Resample();
              posxFc.PutLowClamp( 25.0 );
              posxFc.PutHighClamp( 75.0 );

              // Create and connect an fcurve to rotation X
              Parameter rotx( myCube.GetParameter(L"rotx") );

              FCurve rotxFc;
              rotx.AddFCurve( siStandardFCurve, rotxFc );

              // Set rotxFc with the posx fcurve
              rotxFc.Set( posxFc );

              // Expected output:
              //'INFO : rotxFc nb keys : 100
              //'INFO : rotxFc low clamp: 25
              //'INFO : rotxFc high clamp: 75
              app.LogMessage( L"rotxFc nb keys : " + CString(rotxFc.GetKeys().GetCount()) );
              app.LogMessage( L"rotxFc low clamp: " + CString(rotxFc.GetLowClamp()) );
              app.LogMessage( L"rotxFc high clamp: " + CString(rotxFc.GetHighClamp()) );

CStatus RemoveKey | ( | const CTime & | in_frame,
|  | double | in_tolerance = `DBL_MAX`,
|  | bool | in_overridekeylock = `false` |
| ) |  |  |

Removes the nearest key to the specified frame within the specified tolerance range.

Parameters:

  | in_frame | The frame to look for the key
  | in_tolerance | By default a tolerance of `0.5` frame is specified.
  | in_overridekeylock | True to override the key locks

Returns:
  CStatus::OK success

  CStatus::AccessDenied the fcurve or key are locked

  CStatus::Fail failure

CStatus RemoveKeyAtIndex | ( | LONG | in_index,
|  | bool | in_overridekeylock = `false` |
| ) |  |  |

Removes the key at the specified key index.

Parameters:

  | in_index | The key index
  | in_overridekeylock | True to override the key locks

Returns:
  CStatus::OK success

  CStatus::InvalidArgument index arguments are out of range

  CStatus::AccessDenied the fcurve or key are locked

  CStatus::Fail failure

CStatus RemoveKeysAtIndex | ( | LONG | in_index,
|  | LONG | in_count,
|  | bool | in_overridekeylock = `false` |
| ) |  |  |

Removes a specified number of keys starting at the specified key index. By default `startframe` is the first key and `endframe` is the last key.

Parameters:

  | in_index | The start key index
  | in_count | Number of keys to remove. The value specified must be greater than or equal to `1`.
  | in_overridekeylock | True to override the key locks

Returns:
  CStatus::OK success

  CStatus::InvalidArgument index or count arguments are out of range

  CStatus::AccessDenied the fcurve or key are locked

  CStatus::Fail failure

LONG RemoveKeys | ( | const CTime & | in_startframe = `CTime(DBL_MAX, CTime::CUSTOM)`,
|  | const CTime & | in_endframe = `CTime(DBL_MAX, CTime::CUSTOM)`,
|  | bool | in_overridekeylock = `false` |
| ) |  |  |

Removes all keys within the specified range. By default `startframe` is the first key and `endframe` is the last key.

Parameters:

  | in_startframe | The start frame of the range to search
  | in_endframe | The end frame of the range to search
  | in_overridekeylock | True to override the key locks

Returns:
  The number of keys removed (success)

  -1 (failure)

bool KeyExists | ( | const CTime & | in_frame,
|  | double | in_tolerance = `DBL_MAX` |
| ) |  |  | const

Returns whether a key can be found at the specified frame within the tolerance range.

Parameters:

  | in_frame | The frame to look for a key
  | in_tolerance | By default a tolerance of `0.5` frame is specified.

Returns:
  True if a key can be found at the specified frame within the tolerance range

FCurveKey GetKey | ( | const CTime & | in_frame,
|  | double | in_tolerance = `DBL_MAX` |
| ) |  |  | const

Returns the nearest key to the specified frame within the tolerance range.

Parameters:

  | in_frame | The frame to look for a key
  | in_tolerance | By default a tolerance of `0.5` frame is specified.

Returns:
  The nearest FCurveKey.

  Empty CRef object if the key does not exist.

LONG GetNumKeys | ( | const CTime & | in_startframe = `CTime(DBL_MAX, CTime::CUSTOM)`,
|  | const CTime & | in_endframe = `CTime(DBL_MAX, CTime::CUSTOM)` |
| ) |  |  | const

Returns the number of keys within the specified range. By default `startframe` is the first key and `endframe` is the last key.

Parameters:

  | in_startframe | The start frame of the range to search
  | in_endframe | The end frame of the range to search

Returns:
  The number of keys on the fcurve.

FCurveKey GetKeyAtIndex | ( | LONG | in_index | ) | const

Returns the key at the specified index.

Parameters:

  | in_index | The index of the key to get.

Returns:
  The FCurveKey at the specified index.

  CStatus::InvalidArgument error if the index is out of range

LONG GetKeyIndex | ( | const CTime & | in_frame,
|  | double | in_tolerance = `DBL_MAX` |
| ) |  |  | const

Returns the index of the nearest key to the specified frame within the tolerance range.

Parameters:

  | in_frame | The frame to look for a key
  | in_tolerance | By default a tolerance of 0.5 frame is specified.

Returns:
  The index of the key.

  `-1` if the key does not exist.

CTime GetKeyTime | ( | LONG | in_index | ) | const

Returns the frame of the key at the specified index.

Parameters:

  | in_index | The index of the key to get.

Returns:
  The key time.

  CStatus::InvalidArgument error if the index is out of range.

CValue GetKeyValue | ( | LONG | in_index | ) | const

Returns the value of the key at a specified index.

Parameters:

  | in_index | The index of the key to get.

Returns:
  The key value.

  CStatus::InvalidArgument error if the index is out of range.

CStatus SetKey | ( | LONG | in_index,
|  | const CTime & | in_frame,
|  | const CValue & | in_value,
|  | bool | in_overridekeylock = `false` |
| ) |  |  |

Sets the time (in frames) and value of the key at the specified index.

Parameters:

  | in_index | The index of key to set
  | in_frame | New key frame
  | in_value | New key value
  | in_overridekeylock | True to override the key lock

Returns:
  CStatus::OK success

  CStatus::InvalidArgument if the index is out of range

  CStatus::AccessDenied if the fcurve or key is locked

  CStatus::Fail error if another key already exists at the new frame value

bool IsEditing | ( | void |  | ) | const

Returns true if a bulk edit of the fcurve is in progress.

Returns:
  True if a bulk edit of the fcurve is in progress

CStatus BeginEdit | ( | void |  | ) |

Starts recording bulk edits made to the fcurve. A call to FCurve::BeginEdit must be paired with a call to FCurve::EndEdit, which will commit your changes to the undo/redo stack.

Editing changes can be undone by calling FCurve::UndoEdit and you can check if the fcurve is being bulk edited by using FCurve::IsEditing. If you try to begin another bulk edit a warning is issued, and the current editing session is committed to the undo/redo stack.

Returns:
  CStatus::OK success

  CStatus::Fail failure

CStatus EndEdit | ( | void |  | ) |

Stops recording bulk edits made to the fcurve and commits changes to the undo/redo stack. A call to FCurve::EndEdit must follow a call to FCurve::BeginEdit.

Note:
  If you call FCurve::EndEdit when there is no bulk edit in progress, the function will return an error. You can check if a bulk edit is in process by using the FCurve::IsEditing function.

Returns:
  CStatus::OK success

  CStatus::Fail failure

CStatus UndoEdit | ( | void |  | ) |

Undoes the bulk edits made to the fcurve and closes the current bulk edit.

Note:
  If you call FCurve::UndoEdit when there is no bulk edit is progress, the function returns CStatus::False.

Returns:
  CStatus::OK success

  CStatus::False no bulk edit in progress to undo.

  CStatus::Fail failure

bool GetMute | ( | void |  | ) | const

Returns the fcurve's mute state. If the fcurve is muted it will not update its corresponding parameter when the time changes.

Returns:
  True if the fcurve is muted

Since:
  6.0

CStatus PutMute | ( | bool | in_value | ) |

Sets the fcurve's mute state. If the fcurve is muted it will not update its corresponding parameter when the time changes.

Parameters:

  | in_value | New mute state

Returns:
  CStatus::OK success

  CStatus::Fail failure

Since:
  6.0

CStatus Offset | ( | const CTime & | in_frameOffset,
|  | const CValue & | in_valueOffset |
| ) |  |  |

Offsets the fcurve in time and/or value by a relative amount.

Parameters:

  | in_frameOffset | Time offset
  | in_valueOffset | Value offset

Returns:
  CStatus::OK success

  CStatus::Fail failure

Since:
  6.0

CStatus OffsetKeys | ( | const CFCurveKeyRefArray & | in_Keys,
|  | const CTime & | in_frameOffset,
|  | const CValue & | in_valueOffset |
| ) |  |  |

Offsets fcurve keys in time and/or value by a relative amount.

Parameters:

  | in_Keys | Keys to offset
  | in_frameOffset | Time offset
  | in_valueOffset | Value offset

Returns:
  CStatus::OK success

  CStatus::Fail failure

  CStatus::InvalidArgument if keys are invalid or from a different fcurve

Since:
  6.0

CStatus Scale | ( | double | in_frameFactor,
|  | double | in_valueFactor,
|  | const CTime & | in_frameAnchor,
|  | const CValue & | in_valueAnchor |
| ) |  |  |

Scales the fcurve in time and/or value relative to the given anchor point.

Parameters:

  | in_frameFactor | Frame scale factor
  | in_valueFactor | Value scale factor
  | in_frameAnchor | Frame scale anchor
  | in_valueAnchor | Value scale anchor

Returns:
  CStatus::OK success

  CStatus::Fail failure

Since:
  6.0

CStatus ScaleKeys | ( | const CFCurveKeyRefArray & | in_Keys,
|  | double | in_frameFactor,
|  | double | in_valueFactor,
|  | const CTime & | in_frameAnchor,
|  | const CValue & | in_valueAnchor,
|  | bool | in_ripple = `false` |
| ) |  |  |

Scales fcurve keys in time and/or value relative to the given anchor point.

Parameters:

  | in_Keys | Keys to scale
  | in_frameFactor | Frame scale factor
  | in_valueFactor | Value scale factor
  | in_frameAnchor | Frame scale anchor
  | in_valueAnchor | Value scale anchor
  | in_ripple | True to keep keys before/after the ones being scaled the same distance from the modified keys

Returns:
  CStatus::OK success

  CStatus::Fail failure

  CStatus::InvalidArgument if keys are invalid or from a different fcurve

Since:
  6.0

CStatus ExtendCycle | ( | LONG | in_CyclesBefore,
|  | LONG | in_CyclesAfter |
| ) |  |  |

Extends fcurve to include cycles before/after.

Parameters:

  | in_CyclesBefore | Number of cycles to include before existing fcurve
  | in_CyclesAfter | Number of cycles to include after existing fcurve

Returns:
  CStatus::OK success

  CStatus::Fail failure

  CStatus::InvalidArgument if a negative cycle count is specified

Since:
  6.0

CStatus SnapToNearestFrame | ( | void |  | ) |

Snaps fcurve keys to their nearest frame times.

Returns:
  CStatus::OK success

  CStatus::Fail failure

See also:
  FCurveKey

Since:
  6.0

CStatus MakeRotationsContinuous | ( | void |  | ) |

Removes discontinuities of more than 180 from the fcurve.

Returns:
  CStatus::OK success

  CStatus::Fail failure

Since:
  6.0

CTime GetMinKeyFrame | ( | void |  | ) | const

Returns the smallest key time in the fcurve.

Returns:
  Minimum key time

  CStatus::Fail If the fcurve has no keys

Since:
  6.0

CTime GetMidKeyFrame | ( | void |  | ) | const

Returns the average of the first and last key times in the fcurve.

Returns:
  Center key time

  CStatus::Fail If the fcurve has no keys

Since:
  6.0

CTime GetMaxKeyFrame | ( | void |  | ) | const

Returns the largest key time in the fcurve.

Returns:
  Maximum key time

  CStatus::Fail If the fcurve has no keys

Since:
  6.0

CValue GetMinKeyValue | ( | void |  | ) | const

Returns the smallest key value in the fcurve.

Returns:
  Minimum key value

  CStatus::Fail If the fcurve has no keys

Since:
  6.0

CValue GetMidKeyValue | ( | void |  | ) | const

Returns the average of the largest and smallest key values in the fcurve.

Returns:
  Center key value

  CStatus::Fail If the fcurve has no keys

Since:
  6.0

CValue GetMaxKeyValue | ( | void |  | ) | const

Returns the largest key value in the fcurve.

Returns:
  Maximum key value

  CStatus::Fail If the fcurve has no keys

Since:
  6.0

bool InsertKeyAtFrame | ( | const CTime & | in_frame | ) |

Inserts a key at the time specified by the frame argument. Unlike FCurve::AddKey, this member function maintains the shape of the fcurve.

Parameters:

  | in_frame | The frame at which to insert the new key.

Returns:
  CStatus::Fail If the fcurve has no keys

See also:
  FCurve::AddKey

Since:
  7.5

The documentation for this class was generated from the following file:

- xsi_fcurve.h