GetKeyInfo
 
 
 

GetKeyInfo

Description

Gets information for a function curve key.

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:

For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.

For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).

Scripting Syntax

GetKeyInfo( InputObj, Index, [Parameter], [LeftValue], [RightValue], [LeftTanParam], [LeftTanValue], [RightTanParam], [RightTanValue], [RightSegKind], [Constraints] );

Parameters

Parameter Type Description
InputObj String Component on which is connected a FCurve
Index Integer Index of a key. Keys are indexed from 0 to (nbKeys - 1).

Default Value: 0

Parameter Double Returns the parameter value.
LeftValue Double Returns the left value of the key.
RightValue Double Returns the right value of the key.
LeftTanParam Double Returns the left value of the tangent parameter for the key.
LeftTanValue Double Returns the left value of the tangent for the key.
RightTanParam Double Returns the right value of the tangent parameter for the key.
RightTanValue Double Returns the right value of the tangent for the key.
RightSegKind Integer Returns the segment type of the right side of the key.

Possible Values:

Description:

0 DEFAULT
1 CONSTANT
2 LINEAR
3 CUBIC
Constraints Integer Constraints on the key. This value is a bitfield.

Possible Values:

Description:

0 No constraint.
1 Parameter is immutable.
2 Left and right values are immutable.
4 Function curve is G1 continuous at this key.
8 Left- and right-tangent directions are immutable.
16 Left- and right-tangent lengths are immutable.
32 Parameter, values, and tangents are immutable.
64 Tangents are considered horizontal.
128 Tangents are considered as horizontal when the key is a local extremum.
256 Tangents are adjusted automatically when neighbouring keys are created or moved.

Examples

VBScript Example

' create a null to hold animation
GetPrim "Null"
' Save some keys on the X position of the Null object
SaveKey "Null.kine.local.posx", 1, -5.0
SaveKey "Null.kine.local.posx", 25, 7.0
SaveKey "Null.kine.local.posx", 50, 2.0
' Get the animation source of type FCurve
set collection = GetSource( "Null.kine.local.posx",siFCurveSource  )
for each fcurve in collection
        ' get fcurve info
                GetFCurveInfo fcurve, crvtype, nokeyval, nbKeys, extrap, segtype, lowclamp, highclamp
        LogMessage "FCurve: " & vbCR & vbLF & _
                "Type : " & crvtype & vbCR & vbLF & _
                "No Key Value : " & nokeyval& vbCR & vbLF & _
                "Num Keys : " & nbKeys& vbCR & vbLF & _
                "Extrapolation : " & extrap & vbCR & vbLF & _
                "Default Segment Type : " & segtype& vbCR & vbLF & _
                "Low Clamp : " & seglowclamp & vbCR & vbLF & _
                "High Clamp : " & highclamp & vbCR & vbLF
        for i = 0 to nbkeys - 1
                ' get fcurvekey info
                GetKeyInfo fcurve, i, parameter, leftval, rightval, lefttanparam, lefttanval, righttanparam, righttanval, rightsegkind, constraints
                LogMessage "Key: " & i & vbCR & vbLF & _
                        "KeyParam : " & parameter & vbCR & vbLF & _
                        "LeftValue: " & leftval & vbCR & vbLF & _
                        "RightValue: " & rightval & vbCR & vbLF & _
                        "LeftTanParam: " & lefttanparam & vbCR & vbLF & _
                        "LeftTanValue: " & lefttanval & vbCR & vbLF & _
                        "RightTanParam: " & righttanparam & vbCR & vbLF & _
                        "RightTanValue: " & righttanval & vbCR & vbLF & _
                        "RightSegKind: " & rightsegkind & vbCR & vbLF & _
                        "Constraints: " & constraints & vbCR & vbLF
        next
next 
'INFO : "FCurve: 
'Type : 20
'No Key Value : -5
'Num Keys : 3
'Extrapolation : 1
'Default Segment Type : 3
'Low Clamp : 
'High Clamp : 1.79769313486232E+308
'"
'INFO : "Key: 0
'KeyParam : 3.33666666666667E-02
'LeftValue: -5
'RightValue: -5
'LeftTanParam: 0
'LeftTanValue: 0
'RightTanParam: 0.266933333333333
'RightTanValue: 0
'RightSegKind: 3
'Constraints: 260
'"
'INFO : "Key: 1
'KeyParam : 0.834166666666667
'LeftValue: 7
'RightValue: 7
'LeftTanParam: -0.266933333333333
'LeftTanValue: -1.14285714285714
'RightTanParam: 0.278055555555556
'RightTanValue: 1.19047619047619
'RightSegKind: 3
'Constraints: 260
'"
'INFO : "Key: 2
'KeyParam : 1.66833333333333
'LeftValue: 2
'RightValue: 2
'LeftTanParam: -0.278055555555556
'LeftTanValue: 0
'RightTanParam: 0
'RightTanValue: 0
'RightSegKind: 3
'Constraints: 260
'"

See Also

FCurveKey GetFCurveInfo GetSource