func Class Reference

The func JavaScript global object. Retrieve and modify values of function curves. More...

Public Slots

Func Data
int holdStartFrame (String columnName)
 Returns the Start value from the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors. More...
 
int holdStopFrame (String columnName)
 Returns the Stop value from the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors. More...
 
int holdStep (String columnName)
 Returns the Step value from the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors. More...
 
Functions common to Bezier, Ease and VeloBased
int numberOfPoints (String columnName)
 Returns the number of keyframes and control points on a curve. More...
 
double pointX (String columnName, int point)
 Returns the X value (frame number) of a point on a function curve. More...
 
double pointY (String columnName, int point)
 Returns the Y value of a point on a function curve. More...
 
bool pointConstSeg (String columnName, int point)
 Returns true to indicate that the point is on a constant segment, or false to indicate that the point is not on a constant segment. More...
 
String pointContinuity (String columnName, int point)
 Returns the continuity of the curve that follows the point. One of the following values will be returned, in upper-case: SMOOTH, CORNER or STRAIGHT. More...
 
Bezier Func
double pointHandleLeftX (String columnName, int point)
 Returns the X value of the left handle of a point on a curve. More...
 
double pointHandleLeftY (String columnName, int point)
 Returns the Y value of the left handle of a point on a curve. More...
 
double pointHandleRightX (String columnName, int point)
 Returns the X value of the right handle of a point on a curve. More...
 
double pointHandleRightY (String columnName, int point)
 Returns the Y value of the right handle of a point on a curve. More...
 
Ease Func
double pointEaseIn (String columnName, int point)
 Returns the number of frames in the ease-in. More...
 
double angleEaseIn (String columnName, int point)
 Returns the angle of the ease-in handle. More...
 
double pointEaseOut (String columnName, int point)
 Returns the number of frames in the ease-out. More...
 
double angleEaseOut (String columnName, int point)
 Returns the angle of the ease-out handle. More...
 
double tensionEase (String columnName)
 Returns the tension of the ease column. More...
 
Catmull (Path3d)
int numberOfPointsPath3d (String columnName)
 Returns the number of keyframes and control points on the 3D Path. More...
 
double pointXPath3d (String columnName, int point)
 Returns the value of the specified point on the X path. More...
 
double pointYPath3d (String columnName, int point)
 Returns the value of the specified point on the Y path. More...
 
double pointZPath3d (String columnName, int point)
 Returns the value of the specified point on the Z path. More...
 
double pointTensionPath3d (String columnName, int point)
 Returns the tension value for the specified point on the 3D Path. More...
 
double pointContinuityPath3d (String columnName, int point)
 Returns the continuity value (STRAIGHT, SMOOTH or CORNER) for the specified point on the 3D Path. More...
 
double pointBiasPath3d (String columnName, int point)
 Returns the bias value for the specified point on the 3D Path. More...
 
double pointLockedAtFrame (String columnName, int point)
 Returns the frame at which it's locked, or returns 0 if the point is not locked. More...
 
QScriptValue convertToSeparate (String columnName, String conversionAlgo)
 Converts a 3D Path to a Separate, tuple of three beziers, and select it. More...
 
Func Edition
bool setHoldStartFrame (String columnName, int start)
 Sets the Start value in the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors. More...
 
bool setHoldStopFrame (String columnName, int stop)
 Sets the Stop value in the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors. More...
 
bool setHoldStep (String columnName, int step)
 Sets the Hold value in the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors. More...
 
bool setBezierPoint (String columnName, int frame, double y, double handleLeftX, double handleLeftY, double handleRightX, double handleRightY, bool constSeg, String continuity)
 Sets the values of a point on a Bezier function curve. More...
 
bool setEasePoint (String columnName, int frame, double y, double easeIn, double angleEaseIn, double easeOut, double angleEaseOut, bool constSeg, String continuity)
 Sets the values of a point on an Ease function curve. More...
 
bool setVeloBasedPoint (String columnName, int frame, double y)
 Sets the values of a point on a Velocity-Based function curve. More...
 
bool addKeyFramePath3d (String columnName, int frame, double x, double y, double z, double tension, double continuity, double bias)
 Adds a keyframe to a 3D Path and sets the X, Y and Z value, as well as the tension, continuity and bias. More...
 
bool addCtrlPointAfterPath3d (String columnName, int point, double x, double y, double z, double tension, double continuity, double bias)
 Adds a keyframe after a point on a 3D Path and sets the X, Y and Z values, as well as the tension, continuity and bias. More...
 
bool removePointPath3d (String columnName, int point)
 Used to remove either a key frame, or a control point. More...
 
bool setPointPath3d (String columnName, int point, double x, double y, double z, double tension, double continuity, double bias)
 Used to set values in either a key frame, or a control point, but cannot change a key frame into a control point or a control point into a key frame. More...
 
bool setPath3dPointConstantSegment (String columnName, int point, bool constant)
 Sets the constant segment flag of point i of path p to b. More...
 
bool setPath3dPointConstantSegmentForFrame (String columnName, double frame, bool constant)
 Sets the constant segment flag of point found at frame f of path p to b. More...
 

Detailed Description

The func JavaScript global object. Retrieve and modify values of function curves.

function addSetFunctions()
{
//creates the function columns if needed
if ( !column.add("3DPATH_FUNC", "3DPATH") )
MessageLog.trace( "Error creating 3dpath column" );
if ( !column.add("BEZIER_FUNC", "BEZIER") )
MessageLog.trace( "Error creating bezier column" );
if ( !column.add("EASE_FUNC", "EASE") )
MessageLog.trace( "Error creating ease column" );
// adds 2 keyframes on a 3DPATH at frame 6 and 12
// with values x=2, y=2, z=1, tension=3, continuity=-1, bias=1
func.addKeyFramePath3d( "3DPATH_FUNC", 6, 2, 2, 1, 3, -1, 1 );
func.addKeyFramePath3d( "3DPATH_FUNC", 12, 2, 2, 1, 3, -1, 1);
// removes a keyframe on 3DPATH at frame 12
func.removePoint3DPath( "3DPATH_FUNC", 12 );
// prints the number of points on a 3DPath column
var pathPoints = func.numberOfPointsPath3d("3DPATH_FUNC");
MessageLog.trace( "3DPATH_FUNC column has " + pathPoints + "points" );
// adds a keyframe on a BEZIER at frame 10 with values y=5,
// handle_leftx=9, handle_lefty=5, handle_rightx=12,
// handle_righty=-0.5, constant seg=false, continuity=smooth
if ( ! func.setBezierPoint( "BEZIER_FUNC", 10, 5, 9, 5, 12, - 0.5, false, "SMOOTH" ) )
MessageLog.trace( "Error creating point on bezier" );
// sets the step value for a function column starting at frame 1 upto frame 15 hold 2
func.setHoldStartFrame("BEZIER_FUNC", 1);
func.setHoldStopFrame("BEZIER_FUNC", 15);
func.setHoldStep("BEZIER_FUNC", 2);
// prints the number of points on a function column
var bezPoints = func.numberOfPoints("BEZIER_FUNC");
MessageLog.trace( "BEZIER_FUNC column has " + bezPoints + " points" );
// adds a keyframe on an EASE at frame 10 with values y=5,
// ease_inx=0, ease_iny=0, ease_outx=0, ease_outy=180
// constant seg=true, continuity=straight
if ( ! func.setEasePoint( "EASE_FUNC", 10, 6, 0, 0, 0, 180, true, "STRAIGHT" ) )
MessageLog.trace( "Error creating point on ease" );
}

Member Function Documentation

◆ addCtrlPointAfterPath3d

bool func::addCtrlPointAfterPath3d ( String  columnName,
int  point,
double  x,
double  y,
double  z,
double  tension,
double  continuity,
double  bias 
)
slot

Adds a keyframe after a point on a 3D Path and sets the X, Y and Z values, as well as the tension, continuity and bias.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
x: X value for the point.
y: Y value for the point.
z: Z value for the point.
tension: The tension value of the keyframe.
continuity: The continuity value of the keyframe.
bias: The bias value of the keyframe.
Returns
Returns true if successful.

◆ addKeyFramePath3d

bool func::addKeyFramePath3d ( String  columnName,
int  frame,
double  x,
double  y,
double  z,
double  tension,
double  continuity,
double  bias 
)
slot

Adds a keyframe to a 3D Path and sets the X, Y and Z value, as well as the tension, continuity and bias.

Parameters
columnName: The name of the column.
frame: Frame number for the point.
x: X value for the point.
y: Y value for the point.
z: Z value for the point.
tension: The tension value of the keyframe.
continuity: The continuity value of the keyframe.
bias: The bias value of the keyframe.
Returns
Returns true if successful.

◆ angleEaseIn

double func::angleEaseIn ( String  columnName,
int  point 
)
slot

Returns the angle of the ease-in handle.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the angle of the ease-in handle.

◆ angleEaseOut

double func::angleEaseOut ( String  columnName,
int  point 
)
slot

Returns the angle of the ease-out handle.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the angle of the east-out handle.

◆ convertToSeparate

QScriptValue func::convertToSeparate ( String  columnName,
String  conversionAlgo 
)
slot

Converts a 3D Path to a Separate, tuple of three beziers, and select it.

The example below converts a 3D Path to a Separate with the chosen algorithm. Then links to the Separate beziers (node.linkAttr).

function TB_ConvertToSeparate()
{
var conversionAlgo = "TRANSFORM_MATRIX";
var selectedNode = selection.selectedNode(0);
if(selectedNode == "" || node.type(selectedNode) != "READ")
return;
var path3dColumn = node.linkedColumn(selectedNode, "offset.attr3dpath");
scene.beginUndoRedoAccum("Convert 3D Path to Separate with " + conversionAlgo);
var beziers = func.convertToSeparate(path3dColumn, conversionAlgo);
var offsetAttrType = node.getAttr(selectedNode, frame.current, "offset.separate");
offsetAttrType.setValueAt(true, frame.current);
if (offsetAttrType.boolValue())
{
node.unlinkAttr(selectedNode, "offset.x");
node.unlinkAttr(selectedNode, "offset.y");
node.unlinkAttr(selectedNode, "offset.z");
}
node.linkAttr(selectedNode, "offset.x", beziers[0]);
node.linkAttr(selectedNode, "offset.y", beziers[1]);
node.linkAttr(selectedNode, "offset.z", beziers[2]);
}

With conversionAlgo = "TRANSFORM_MATRIX" : returns a identical spline except for the frame rate, i.e. there will be a slight change on frame's positions on the spline. When using "TRANSFORM_MATRIX" the velocity information is not preserved. With conversionAlgo = "BEZIER_FITTER" : Prioritize frame rate and velocity changes over spline's integrity.

Parameters
columnName: The name of the column.
conversionAlgo: The name of the conversion method used. Either "TRANSFORM_MATRIX" or "BEZIER_FITTER".
Returns
Returns an array of the names of the resulting functions as separated beziers.

◆ holdStartFrame

int func::holdStartFrame ( String  columnName)
slot

Returns the Start value from the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors.

Parameters
columnName: The name of the column.
Returns
Returns the Start value from the Hold Value Editor dialog box.

◆ holdStep

int func::holdStep ( String  columnName)
slot

Returns the Step value from the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors.

Parameters
columnName: The name of the column.
Returns
Returns the Step value from the Hold Value Editor dialog box.

◆ holdStopFrame

int func::holdStopFrame ( String  columnName)
slot

Returns the Stop value from the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors.

Parameters
columnName: The name of the column.
Returns
Returns the Stop value from the Hold Value Editor dialog box.

◆ numberOfPoints

int func::numberOfPoints ( String  columnName)
slot

Returns the number of keyframes and control points on a curve.

Parameters
columnName: The name of the column.
Returns
Returns the number of keyframes and control points on a curve.

◆ numberOfPointsPath3d

int func::numberOfPointsPath3d ( String  columnName)
slot

Returns the number of keyframes and control points on the 3D Path.

Parameters
columnName: The name of the column.
Returns
Returns the number of keyframes and control points on the 3D Path.

◆ pointBiasPath3d

double func::pointBiasPath3d ( String  columnName,
int  point 
)
slot

Returns the bias value for the specified point on the 3D Path.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the bias value for the specified point on the 3D Path. Returns 0 if the current value is outside -1 and 1.

◆ pointConstSeg

bool func::pointConstSeg ( String  columnName,
int  point 
)
slot

Returns true to indicate that the point is on a constant segment, or false to indicate that the point is not on a constant segment.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns true to indicate that the point is on a constant segment, or false to indicate that the point is not on a constant segment.

◆ pointContinuity

String func::pointContinuity ( String  columnName,
int  point 
)
slot

Returns the continuity of the curve that follows the point. One of the following values will be returned, in upper-case: SMOOTH, CORNER or STRAIGHT.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the continuity of the curve that follows the point.

◆ pointContinuityPath3d

double func::pointContinuityPath3d ( String  columnName,
int  point 
)
slot

Returns the continuity value (STRAIGHT, SMOOTH or CORNER) for the specified point on the 3D Path.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the continuity value for the specified point on the 3D Path. Returns 0 if the current value is outside -1 and 1.

◆ pointEaseIn

double func::pointEaseIn ( String  columnName,
int  point 
)
slot

Returns the number of frames in the ease-in.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the number of frames in the ease-in.

◆ pointEaseOut

double func::pointEaseOut ( String  columnName,
int  point 
)
slot

Returns the number of frames in the ease-out.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the number of frames in the ease-out.

◆ pointHandleLeftX

double func::pointHandleLeftX ( String  columnName,
int  point 
)
slot

Returns the X value of the left handle of a point on a curve.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the X value of the left handle of a point on a curve.

◆ pointHandleLeftY

double func::pointHandleLeftY ( String  columnName,
int  point 
)
slot

Returns the Y value of the left handle of a point on a curve.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the Y value of the left handle of a point on a curve.

◆ pointHandleRightX

double func::pointHandleRightX ( String  columnName,
int  point 
)
slot

Returns the X value of the right handle of a point on a curve.

Parameters
columnName: The name of the column
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the X value of the right handle of a point on a curve.

◆ pointHandleRightY

double func::pointHandleRightY ( String  columnName,
int  point 
)
slot

Returns the Y value of the right handle of a point on a curve.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the Y value of the right handle of a point on a curve.

◆ pointLockedAtFrame

double func::pointLockedAtFrame ( String  columnName,
int  point 
)
slot

Returns the frame at which it's locked, or returns 0 if the point is not locked.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the frame at which it's locked, or returns 0 if the point is not locked.

◆ pointTensionPath3d

double func::pointTensionPath3d ( String  columnName,
int  point 
)
slot

Returns the tension value for the specified point on the 3D Path.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the tension value for the specified point on the 3D Path. Returns 0 if the current value is outside -1 and 1.

◆ pointX

double func::pointX ( String  columnName,
int  point 
)
slot

Returns the X value (frame number) of a point on a function curve.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the X value (frame number) of a point on a function curve.

◆ pointXPath3d

double func::pointXPath3d ( String  columnName,
int  point 
)
slot

Returns the value of the specified point on the X path.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the value of the specified point on the X path.

◆ pointY

double func::pointY ( String  columnName,
int  point 
)
slot

Returns the Y value of a point on a function curve.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the Y value of a point on a function curve.

◆ pointYPath3d

double func::pointYPath3d ( String  columnName,
int  point 
)
slot

Returns the value of the specified point on the Y path.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the value of the specified point on the Y path.

◆ pointZPath3d

double func::pointZPath3d ( String  columnName,
int  point 
)
slot

Returns the value of the specified point on the Z path.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns the value of the specified point on the Z path.

◆ removePointPath3d

bool func::removePointPath3d ( String  columnName,
int  point 
)
slot

Used to remove either a key frame, or a control point.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
Returns
Returns true if successful.

◆ setBezierPoint

bool func::setBezierPoint ( String  columnName,
int  frame,
double  y,
double  handleLeftX,
double  handleLeftY,
double  handleRightX,
double  handleRightY,
bool  constSeg,
String  continuity 
)
slot

Sets the values of a point on a Bezier function curve.

Parameters
columnName: The name of the column.
frame: Frame number for the point.
y: Y value for the point.
handleLeftX: X value for the left handle of the point.
handleLeftY: Y value for the left handle.
handleRightX: X value for the right handle.
handleRightY: Y value for the right handle.
constSeg: Boolean expression (with a true or false value) to indicate whether the segment is constant or interpolated.
continuity: String value for the continuity of the point. The string must be in all upper-case. The following are the acceptable values: STRAIGHT, SMOOTH and CORNER.
Returns
Returns true if successful.

◆ setEasePoint

bool func::setEasePoint ( String  columnName,
int  frame,
double  y,
double  easeIn,
double  angleEaseIn,
double  easeOut,
double  angleEaseOut,
bool  constSeg,
String  continuity 
)
slot

Sets the values of a point on an Ease function curve.

Parameters
columnName: The name of the column.
frame: Frame number for the point.
y: Y value for the point.
easeIn: The number of frames in the ease-in.
angleEaseIn: The angle of the ease-in handle.
easeOut: The number of frames in the ease-out.
angleEaseOut: The angle of the ease-out handle.
constSeg: Boolean expression (with a true or false value) to indicate whether the segment is constant or interpolated.
continuity: String value for the continuity of the point. The string must be in all upper-case. The following are the acceptable values: STRAIGHT, SMOOTH and CORNER.
Returns
Returns true if successful.

◆ setHoldStartFrame

bool func::setHoldStartFrame ( String  columnName,
int  start 
)
slot

Sets the Start value in the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors.

Parameters
columnName: The name of the column.
start: The start frame of the hold.
Returns
Returns true if successful.

◆ setHoldStep

bool func::setHoldStep ( String  columnName,
int  step 
)
slot

Sets the Hold value in the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors.

Parameters
columnName: The name of the column.
step: The value of the steps in the hold.
Returns
Returns true if successful.

◆ setHoldStopFrame

bool func::setHoldStopFrame ( String  columnName,
int  stop 
)
slot

Sets the Stop value in the Hold Value Editor dialog box, for Bezier, Ease and Velo-based Function Editors.

Parameters
columnName: The name of the column.
stop: The stop frame of the hold.
Returns
Returns true if successful.

◆ setPath3dPointConstantSegment

bool func::setPath3dPointConstantSegment ( String  columnName,
int  point,
bool  constant 
)
slot

Sets the constant segment flag of point i of path p to b.

Parameters
columnNameThe name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
constant: bool flag.
Returns
Returns true if successful.

◆ setPath3dPointConstantSegmentForFrame

bool func::setPath3dPointConstantSegmentForFrame ( String  columnName,
double  frame,
bool  constant 
)
slot

Sets the constant segment flag of point found at frame f of path p to b.

Parameters
columnNameThe name of the column.
frame: The frame number at which the point to modify is located
constant: bool flag.
Returns
Returns true if successful.

◆ setPointPath3d

bool func::setPointPath3d ( String  columnName,
int  point,
double  x,
double  y,
double  z,
double  tension,
double  continuity,
double  bias 
)
slot

Used to set values in either a key frame, or a control point, but cannot change a key frame into a control point or a control point into a key frame.

To change a key frame into a control point or a control point into a key frame, you must remove the point and add a new point.

Parameters
columnName: The name of the column.
point: The number of the point on the curve, from 0 to n-1, where n is the total number of points.
x: X value for the point.
y: Y value for the point.
z: Z value for the point.
tension: The tension value of the keyframe.
continuity: The continuity value of the keyframe.
bias: The bias value of the keyframe.
Returns
Returns true if successful.

◆ setVeloBasedPoint

bool func::setVeloBasedPoint ( String  columnName,
int  frame,
double  y 
)
slot

Sets the values of a point on a Velocity-Based function curve.

Parameters
columnName: The name of the column.
frame: Frame number for the point.
y: Y value for the point.
Returns
Returns true if successful.

◆ tensionEase

double func::tensionEase ( String  columnName)
slot

Returns the tension of the ease column.

Parameters
columnName: The name of the column.
Returns
Returns the tension of the ease, 0 if the given column isn't an ease column.