Object Hierarchy | 関連する C++クラス:FCurve
FCurve
v1.0
FCurve(ファンクションカーブ)オブジェクトは、Softimage のFCurve 属性の取得と設定、およびFCurveキーの作成、取得、修正、削除を実行する関数のセットへのアクセスを提供します。
F カーブは、Parameter.AddFCurve2 メソッドおよび Parameter.AddFCurve メソッドによりパラメータを作成し、接続することができます。Parameter 上の既存の FCurve にアクセスする場合は、Parameter.Source メソッドを使用します。F カーブは、siDouble、siFloat、siInt4、siInt2、siByte、siUInt4、siUInt2、および SiUByte(これらのパラメータの定義については siVariantType を参照)でサポートされています。
FCurveKey を定義すると、キーの値は、キーの値の型の条件と一致するように調整されます。ブール型、整数型の FCurve では、この値は切り捨て処理されます。たとえば、値 3.5 を整数の FCurve に指定すると、3 になります。ブールFCurve では、0 以外の値は trueとして解釈されます。
SIObject.Parent は、FCurve の親を戻します。パラメータに接続する F カーブでは、Parameter オブジェクトが親と見なされます。ActionSource オブジェクトに含まれる F カーブでは、AnimationSourceItem オブジェクトが親となります。
注 : 詳細については、Softimage ユーザ ガイドの「F カーブの補間および外挿」を参照してください。
/* This example demonstrates how to get the parent of an fcurve. */ // Set up the scene with a custom pset on a null NewScene( null, false ); var n = ActiveSceneRoot.AddNull(); var pset = n.AddCustomProperty( "CustomPSet" ); var x = pset.AddParameter3( "X", siDouble, 0, 0, 100 ); LogMessage( "x value = " + x.value, siInfo ) LogMessage( "x min/max = " + x.min + ", " + x.max, siInfo ) // Set an fcurve on the custom parameter var fc = x.AddFCurve2( null, null ); var param = fc.Parent; LogMessage( "parent of fcurve = " + param.FullName, siInfo ); LogMessage( "param isequal to x = " + param.IsEqualTo(x), siInfo ); // Outputs: //INFO : "x value = 0" //INFO : "x min/max = 0, 100" //INFO : "parent of fcurve = null.CustomPSet.X" //INFO : "param isequal to x = true" |
' ========================================================================== ' This part of the script just sets up the sphere, curve, and the path ' constraint between them. ' -------------------------------------------------------------------------- ' Set up scene context Set oRoot = ActiveSceneRoot ' Create sphere that will be animated with path constraint Set oSphere = oRoot.AddGeometry( "Sphere", "MeshSurface" ) ' Create curve for path constraint Set oCrv = SICreateCurve( "crvlist", 3, 0 ) SIAddPointOnCurveAtEnd oCrv, _ -7.87711815167134, -1.9399113143663, 0.193991131436629, False SIAddPointOnCurveAtEnd oCrv, _ 8.74360114835504, -5.93730432578764, 0.593730432578766, False SIAddPointOnCurveAtEnd oCrv, _ 7.60141901636287, 5.15350177452872, -0.515350177452866, False SIAddPointOnCurveAtEnd oCrv, _ -6.30169452133709, 5.03593139183983, -0.50359313918398, False SIAddPointOnCurveAtEnd oCrv, _ 2.71760576232661, -6.21163521872843, 0.621163521872845, False ' Apply path constraint to sphere SelectObj oSphere, , True ApplyPath oSphere, oCrv, 10.0, 95.5, 2, False, False ' ========================================================================== ' This part of the script finds the existing fcurve & gets the time in ' frames of the first and last key. ' -------------------------------------------------------------------------- ' Get all the meshes under the root Set oMeshes = oRoot.FindChildren(,,siMeshFamily) LogMessage "Number of meshes found: " & oMeshes.Count ' Iterate over the meshes to find the one with the fcurve For Each s In oMeshes ' Get the path constraint on the object Set oCns = s.Kinematics.Constraints("PathCns") ' Just to make sure script doesn't crash if not found If oCns <> "Nothing" Then ' Getting path percentage to check that it's ok LogMessage "Path percentage = " & oCns.perc.Value ' Get fcurve attached to path percentage Set oFCurve = oCns.perc.Source ' Getting first & last curves on source If oFCurve.Keys.Count > 0 Then dFCKeyA = oFCurve.Keys(0).Time dFCKeyZ = oFCurve.Keys(oFCurve.Keys.Count - 1).Time ' Print values LogMessage "First key in time is at frame " & dFCKeyA LogMessage "Last key in time is at frame " & dFCKeyZ End If End If Next ' Output of above script is: ' -------------------------- 'INFO : "Number of meshes found: 1" 'INFO : "Path percentage = 100" 'INFO : "First key in time is at frame 4.126" 'INFO : "Last key in time is at frame 90.274" |
' ' This example manipulates the FCurve that drives a Linked Parameter ' dim oControlPSet, oControlledPSet set oControlPSet = ActiveSceneRoot.AddProperty( "CustomProperty", false, "ControlPSet" ) oControlPSet.AddParameter2 "LinkSrc", siInt4, 5, 0, 20, 0, 20, 0, siAnimatable set oControlledPSet = ActiveSceneRoot.AddProperty( "CustomProperty", false, "ControlledPSet" ) oControlledPSet.AddParameter2 "LinkDest", siInt4, 5, 0, 20, 0, 20, 0, siAnimatable 'Create linked parameter SetExpr "ControlledPSet.LinkDest", "l_fcv( ControlPset.LinkSrc )" 'Important: This is how you get to the FCurve so you can 'create the specific relationship dim oFCurve, oExpr set oExpr = oControlledPSet.Parameters( "LinkDest" ).Source set oFCurve = oExpr.Parameters( "l_fcv" ).Source oFCurve.BeginEdit oFCurve.RemoveKeys oFCurve.Interpolation = siLinearInterpolation 'Important: Linked fcurves are time independant. So the in_Frame value is 'used directly as input (i.e. no conversion from frames to seconds is done). 'When linksrc is 0 then linkdest is 0 oFCurve.AddKey 0, 1 'when linksrc is 1 then linkdest is 3 oFCurve.AddKey 1, 3 'when linksrc is 2 then listdest is 2 oFCurve.AddKey 2, 2 'When linksrc is 10 the listdest is 20 oFCurve.AddKey 10, 20 oFCurve.EndEdit 'Demonstrate the relationship oControlPSet.LinkSrc.Value = 1 Logmessage oControlledPSet.LinkDest.Value oControlPSet.LinkSrc.Value = 10 Logmessage oControlledPSet.LinkDest.Value 'Expected results: 'INFO : 3 'INFO : 20 |