Object Hierarchy | 関連する C++クラス:ClipRelation
ClipRelation
v4.0
ClipRelation オブジェクトは、アニメーションミキサの 2 つのClipオブジェクト間の関係を表します。クリップの関係は、異なるタイプのクリップ間の関係を保持する場合に特に便利です。ClipRelation オブジェクトを使用して、ミキサを使用せずにこれらのリンクを作成したり、そのプロパティを取得および設定することができます。
デフォルトでは、クリップの関係によって作成されるのは、リンクされたクリップのTimeControlのスタートオフセット、クリップイン、およびクリップアウトの値の関係です。関連するパラメータ(マスタまたはスレーブクリップのどちらかの)の値を 1 つでも変更すると、他方のクリップの値もそれに応じて変更されます。その意味で、クリップの関係には双方向性があります。
各関係には、アクティブ状態Parameter(StartActiveness、ClipInActiveness、および ClipOutActiveness)とオフセットがあります。オフセットとは、マスタクリップパラメータとスレーブクリップパラメータとの値の差異を表すものです。オフセットの値を変更すると、マスタクリップの値を基準としてスレーブクリップの値が変更されます。マスタクリップとスレーブクリップを入れ替える場合は、ClipRelation.SwapMasterAndSlaveClipを使用できます。
ClipContainer.AddRelationを使用してClipRelation を作成できます。また、Clip.RelationsまたはClipContainer.NestedRelationsのどちらを使用しても、ClipRelation にアクセスできます。マスタまたはスレーブクリップにアクセスする場合は、ClipRelation.MasterClipまたはClipRelation.SlaveClipを使用します。
/* --------------------------------------------------------------------------------------------------
This example shows how to create a ClipRelation, how to access its offsets and how modifying
one makes an impact on the TimeControl of the master and slave clip.
*/
NewScene(null, false);
// Set up scene with a cone and add some animation
CreatePrim("Cone", "MeshSurface", null, null);
Translate(null, 5.57429595406375, 0.195303936039821, -1.95303936039821E-02,
siRelative, siView, siObj, siXYZ, null, null, siXYZ, null, null, null, null, null, null, 0);
var myTforms = "cone.kine.local.sclx,cone.kine.local.scly,cone.kine.local.sclz,";
myTforms += "cone.kine.local.rotx,cone.kine.local.roty,cone.kine.local.rotz";
myTforms += "cone.kine.local.posx,cone.kine.local.posy,cone.kine.local.posz";
StoreAction(null, myTforms, 1, "StoredStaticPose", true, 1, 5, false, false);
SelectObj("cone", null, true);
// Add 2 tracks to the mixer and create 2 separate clips for the stored animation
AddTrack("Scene_Root", "Scene_Root", 0, null, null);
AddTrack("Scene_Root", "Scene_Root", 0, null, null);
var myClip = AddClip("Scene_Root", "Sources.Scene_Root.StoredStaticPose", null,
"Mixer.Mixer_Anim_Track", 19, null, null, null, null);
var myClip1 = AddClip("Scene_Root", "Sources.Scene_Root.StoredStaticPose", null,
"Mixer.Mixer_Anim_Track1", 47, null, null, null, null);
var oRootMixer = ActiveSceneRoot.Mixer;
// Set up a clip relation between the two clips
var myClipRelation = oRootMixer.AddRelation(myClip, myClip1, "myRelation");
LogMessage(">>>Original ClipRelation information.");
Print_ClipRelation_Info(myClipRelation);
LogMessage(">>>Modifying the startoffset value of the ClipRelation.");
myClipRelation.Parameters("StartOffset").value = myClipRelation.Parameters("StartOffset").Value + 3;
Print_ClipRelation_Info(myClipRelation);
LogMessage(">>>Modifying the start value of the TimeControl of the master clip.");
var myMasterClipTC = myClipRelation.MasterClip.TimeControl;
myMasterClipTC.Parameters("StartOffset").Value = myMasterClipTC.Parameters("StartOffset").Value + 4;
Print_ClipRelation_Info(myClipRelation);
LogMessage(">>>Swapping master and slave clip.");
myClipRelation.SwapMasterAndSlaveClip();
Print_ClipRelation_Info(myClipRelation);
LogMessage(">>>Modifying the startoffset value of the ClipRelation.");
myClipRelation.Parameters("StartOffset").Value = myClipRelation.Parameters("StartOffset").Value + 3;
Print_ClipRelation_Info(myClipRelation);
/* --------------------------------------------------------------------------------------------------
Utility function to print relation information, including its name and offset values.
*/
function Print_ClipRelation_Info( in_ClipRelation )
{
LogMessage( "The clip relation name is: " + in_ClipRelation.Name );
// Printing the offset between the master and slave clips
LogMessage( "The start offset is: " + in_ClipRelation.Parameters("StartOffset").Value );
LogMessage( "The ClipIn offset is: " + in_ClipRelation.Parameters("ClipInOffset").Value );
LogMessage( "The ClipOut offset is: " + in_ClipRelation.Parameters("ClipOutOffset").Value );
// Printing the master clip values
var masterClip = in_ClipRelation.MasterClip;
LogMessage( "The master clip name is: " + masterClip.Name );
var masterTimeControl = masterClip.TimeControl;
LogMessage( "The master clip start value is: " + masterTimeControl.StartOffset);
LogMessage( "The master clip ClipIn value is: " + masterTimeControl.ClipIn);
LogMessage( "The master clip ClipOut value is: " + masterTimeControl.ClipOut );
// Printing the slave clip values
var slaveClip = in_ClipRelation.SlaveClip;
LogMessage( "The slave clip name is: " + slaveClip.Name );
var slaveTimeControl = slaveClip.TimeControl;
LogMessage( "The slave clip start value is: " + slaveTimeControl.StartOffset );
LogMessage( "The slave clip ClipIn value is: " + slaveTimeControl.ClipIn );
LogMessage( "The slave clip ClipOut value is: " + slaveTimeControl.ClipOut );
LogMessage( " ");
} |