FCurveKey.Interpolation
 
 
 

FCurveKey.Interpolation

Description

Sets or returns the interpolation type of the right side of the fcurve segment (one of the values from the siFCurveKeyInterpolation enum.

Fcurve segment interpolation only applies to standard fcurves (where the type is siStandardFCurve). All other fcurve types return the siConstantKeyInterpolation value.

If you try to set the key interpolation with the siDefaultInterpolation value, it is ignored and returns S_FALSE in C++.

For more information, see "FCurve Interpolation and Extrapolation" in the Softimage user guide.

C# Syntax

// get accessor
siFCurveKeyInterpolation rtn = FCurveKey.Interpolation;
// set accessor
FCurveKey.Interpolation = siFCurveKeyInterpolation;

Examples

1. JScript Example

/*
        This example illustrates how to set interpolation for individual keys 
*/ 
NewScene( null, false );
var n = Application.ActiveSceneRoot.AddNull();
SIAddCustomParameter( "null", "X", siDouble, 0, 0, 100, null, 5, 0, 5 );
var cpset = Dictionary.GetObject( "null.CustomPSet" );
var x = cpset.Parameters("X");
Application.LogMessage( "x value = " + x.Value  );
Application.LogMessage( "x min/max = " + x.Min + ", " + x.Max );
// Add a standard fcurve with 5 keys
var fc = x.AddFCurve2( new Array( 1,0.52, 25.5,5, 50,0.45, 75,10.23, 100,0.76 ), siStandardFCurve );
// Set the interpolation for the individual keys
var k; var i = 0;
// Set constant interpolation
k = fc.Keys(i)
Application.LogMessage( "fcurve key " + i + " interpolation before = " + k.Interpolation );
k.Interpolation = siConstantKeyInterpolation;
Application.LogMessage( "fcurve key " + i + " interpolation after = " + k.Interpolation );
Application.LogMessage( "fcurve key " + i + " left = " + k.Left + " right = " + k.Right );
i++;
// Set cubic interpolation
k = fc.Keys(i)
Application.LogMessage( "fcurve key " + i + " interpolation before = " + k.Interpolation );
k.Interpolation = siCubicKeyInterpolation;
Application.LogMessage( "fcurve key " + i + " interpolation after = " + k.Interpolation );
Application.LogMessage( "fcurve key " + i + " left = " + k.Left + " right = " + k.Right );
i++;
// Set linear interpolation
k = fc.Keys(i)
Application.LogMessage( "fcurve key " + i + " interpolation before = " + k.Interpolation );
k.Interpolation = siLinearKeyInterpolation;
Application.LogMessage( "fcurve key " + i + " interpolation after = " + k.Interpolation );
Application.LogMessage( "fcurve key " + i + " left = " + k.Left + " right = " + k.Right );
i++;
// Expected results:
//INFO : x value = 0
//INFO : x min/max = 0, 100
//INFO : fcurve key 0 interpolation before = 3
//INFO : fcurve key 0 interpolation after = 1
//INFO : fcurve key 0 left = 0.52 right = 0.52
//INFO : fcurve key 1 interpolation before = 3
//INFO : fcurve key 1 interpolation after = 3
//INFO : fcurve key 1 left = 5 right = 5
//INFO : fcurve key 2 interpolation before = 3
//INFO : fcurve key 2 interpolation after = 2
//INFO : fcurve key 2 left = 0.45 right = 0.45

2. VBScript Example

'
' This example illustrates how to set interpolation for individual keys 
' 
NewScene , false 
set n = Application.ActiveSceneRoot.AddNull()
SIAddCustomParameter "null", "X", siDouble, 0, 0, 100, , 5, 0, 5 
set cpset = Dictionary.GetObject( "null.CustomPSet" )
set x = cpset.Parameters("X")
Application.LogMessage "x value = " & x.Value  
Application.LogMessage "x min/max = " & x.Min & ", " & x.Max 
' Add a standard fcurve with 5 keys
set fc = x.AddFCurve2( array( 1,0.52, 25.5,5, 50,0.45, 75,10.23, 100,0.76 ), siStandardFCurve )
' Set the interpolation for the individual keys
dim k, i
' Set constant interpolation
i = 0
set k = fc.Keys(i)
Application.LogMessage "fcurve key " & i & " interpolation before = " & k.Interpolation 
k.Interpolation = siConstantKeyInterpolation
Application.LogMessage "fcurve key " & i & " interpolation after = " & k.Interpolation 
Application.LogMessage "fcurve key " & i & " left = " & k.Left & " right = " & k.Right 
i = i + 1
' Set cubic interpolation
set k = fc.Keys(i)
Application.LogMessage "fcurve key " & i & " interpolation before = " & k.Interpolation 
k.Interpolation = siCubicKeyInterpolation
Application.LogMessage "fcurve key " & i & " interpolation after = " & k.Interpolation 
Application.LogMessage "fcurve key " & i & " left = " & k.Left & " right = " & k.Right 
i = i + 1
' Set linear interpolation
set k = fc.Keys(i)
Application.LogMessage "fcurve key " & i & " interpolation before = " & k.Interpolation 
k.Interpolation = siLinearKeyInterpolation
Application.LogMessage "fcurve key " & i & " interpolation after = " & k.Interpolation 
Application.LogMessage "fcurve key " & i & " left = " & k.Left & " right = " & k.Right 
i = i + 1
' Expected results:
'INFO : x value = 0
'INFO : x min/max = 0, 100
'INFO : fcurve key 0 interpolation before = 3
'INFO : fcurve key 0 interpolation after = 1
'INFO : fcurve key 0 left = 0.52 right = 0.52
'INFO : fcurve key 1 interpolation before = 3
'INFO : fcurve key 1 interpolation after = 3
'INFO : fcurve key 1 left = 5 right = 5
'INFO : fcurve key 2 interpolation before = 3
'INFO : fcurve key 2 interpolation after = 2
'INFO : fcurve key 2 left = 0.45 right = 0.45

3. Python Example

#
# This example illustrates how to set interpolation for individual keys 
# 
from win32com.client import constants as c
Application.NewScene( "", 0 )
n = Application.ActiveSceneRoot.AddNull()
Application.SIAddCustomParameter( "null", "X", c.siDouble, 0, 0, 100, None, 5, 0, 5 )
cpset = Application.Dictionary.GetObject( "null.CustomPSet" )
x = cpset.Parameters("X")
Application.LogMessage( "x value = %d" % (x.Value) )
Application.LogMessage( "x min/max = %d, %d" % (x.Min,x.Max) )
# Add a standard fcurve with 5 keys
fc = x.AddFCurve2( [ 1,0.52, 25.5,5, 50,0.45, 75,10.23, 100,0.76 ], c.siStandardFCurve )
# Set constant interpolation for key 0
i = 0
k = fc.Keys(i)
Application.LogMessage( "fcurve key %d interpolation before = %d" % (i,k.Interpolation) )
k.Interpolation = c.siConstantKeyInterpolation
Application.LogMessage( "fcurve key %d interpolation after = %d" % (i,k.Interpolation) )
Application.LogMessage( "fcurve key %d left = %d right = %d" % (i,k.Left,k.Right) )
i = i + 1
# Set cubic interpolation for key 1
k = fc.Keys(i)
Application.LogMessage( "fcurve key %d interpolation before = %d" % (i,k.Interpolation) )
k.Interpolation = c.siCubicKeyInterpolation
Application.LogMessage( "fcurve key %d interpolation after = %d" % (i,k.Interpolation) )
Application.LogMessage( "fcurve key %d left = %d right = %d" % (i,k.Left,k.Right) )
i = i + 1
# Set linear interpolation for key 2
k = fc.Keys(i)
Application.LogMessage( "fcurve key %d interpolation before = %d" % (i,k.Interpolation) )
k.Interpolation = c.siLinearKeyInterpolation
Application.LogMessage( "fcurve key %d interpolation after = %d" % (i,k.Interpolation) )
Application.LogMessage( "fcurve key %d left = %d right = %d" % (i,k.Left,k.Right) )
i = i + 1
# Expected results:
#INFO : x value = 0
#INFO : x min/max = 0, 100
#INFO : fcurve key 0 interpolation before = 3
#INFO : fcurve key 0 interpolation after = 1
#INFO : fcurve key 0 left = 0 right = 0
#INFO : fcurve key 1 interpolation before = 3
#INFO : fcurve key 1 interpolation after = 3
#INFO : fcurve key 1 left = 5 right = 5
#INFO : fcurve key 2 interpolation before = 3
#INFO : fcurve key 2 interpolation after = 2
#INFO : fcurve key 2 left = 0 right = 0