FCurve.DependsOnFrameRate

Introduced

v5.0

Description

Sets or returns the fcurve's dependency on the frame rate (time) as a Boolean (true if the fcurve is dependent on the frame rate). 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 finetune 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).

C# Syntax

// get accessor
Boolean rtn = FCurve.DependsOnFrameRate;
// set accessor
FCurve.DependsOnFrameRate = Boolean;

Examples

JScript Example

/* 
	This example illustrates how to create an fcurve and set its X axis 
	to be time independent. That means that the FCurve will not rescale when the 
	scene frame rate changes
*/ 
// 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( 30.00, -5.00, 50.00, 5.00 );
// Create an empty FCurve
oFCurve = oPosX.AddFCurve2( null, siStandardFCurve );
// Get the current DependsOnFrameRate value
bDependsOnFrameRate = oFCurve.DependsOnFrameRate
Application.LogMessage( 'oFCurve.DependsOnFrameRate before = ' + bDependsOnFrameRate , siInfo )
// Set the fc DependsOnFrameRate to false
oFCurve.DependsOnFrameRate = false
bDependsOnFrameRate = oFCurve.DependsOnFrameRate
Application.LogMessage( 'oFCurve.DependsOnFrameRate after = ' + bDependsOnFrameRate, siInfo )
// Set the fcurve keys
oFCurve.SetKeys( aKeys );
// Validate that the key parameter does not change with the frame rate
oFCurveKey = oFCurve.Keys(0);
Application.LogMessage( 'oFCurveKey.Time before = ' + oFCurveKey.Time, siInfo );
Application.SetValue( 'PlayControl.Rate', 100 ) ;
oFCurveKey = oFCurve.Keys(0)
Application.LogMessage( 'oFCurveKey.Time after = ' + oFCurveKey.Time, siInfo );
// Produces the following output: 
//
//INFO : oFCurve.DependsOnFrameRate before = true
//INFO : oFCurve.DependsOnFrameRate after = false
//INFO : oFCurveKey.Time before = 30
//INFO : oFCurveKey.Time after = 30
// Because the FCurve was set as being time independant, the 
// key times are not changed when changing the frame rate
// of the scene.