F カーブセグメントの右側の補間タイプを(siFCurveKeyInterpolation 列挙型の値の 1 つとして)設定したり、戻したりします。
F カーブセグメント補間は、標準F カーブ(タイプが siStandardFCurve のもの)にのみ適用されます。他のすべての F カーブタイプでは、siConstantKeyInterpolation 値が戻されます。
siDefaultInterpolation 値を使用してキー補間を設定しようとした場合、その操作は無視され、C++ で S_FALSE が戻されます。
詳細については、Softimage ユーザ ガイドの「F カーブの補間および外挿」を参照してください。
// get accessor siFCurveKeyInterpolation rtn = FCurveKey.Interpolation; // set accessor FCurveKey.Interpolation = siFCurveKeyInterpolation; |
/* 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 |
' ' 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 |
# # 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 |