Object Hierarchy | Related C++ Class: Track
Track
v4.0
The Track object represents the container of clips used to
sequence clips in the ClipContainer. You can retrieve the track
object using ClipContainer.Tracks property. A
track contains only a specific type of clips; for example, audio
clips (where Clip.Type == siClipAudioType) are the only type of
tracks found in an audio track (where Track.Type ==
siTrackAudioType). The base property SIObject.Type returns one of the values
contained in siTrackType.
Tracks can only be added using the AddTrack command (there is currently
no way to add a track using the Object Model).
/*
This example demonstrates how to create a compound clip from scripting.
It also shows that when retrieving clips from the ClipContainer it only
returns clips that are on tracks nested directly under it.
*/
NewScene( null, false );
var oRoot = Application.ActiveSceneRoot;
var oCube = oRoot.AddGeometry( "Cube", "MeshSurface" );
// Creating the first animation source
var sParams = oCube + ".kine.local.posx," + oCube + ".kine.local.posy," + oCube + ".kine.local.posz";
var oSource = StoreAction( oRoot, sParams, 1, "StoredStaticPose", 1, 1, 5, 0, 0 );
// Creating the first clip
var oClip = AddClip( oRoot, oSource );
LogMessage( "First created clip " + oClip.FullName );
oCube.posx.Value = 3.0;
// Creating the second animation source
var oSource2 = StoreAction( oRoot, sParams, 1, "StoredStaticPose", 1, 7, 9, 0, 0 );
// Creating the second clip
var oClip2 = AddClip( oRoot, oSource2 );
LogMessage( "Second created clip " + oClip2.FullName );
// This function prints the clip names contained in a clip collection
function PrintClips(oClipCollection)
{
for (var i=0; i<oClipCollection.Count; i++) {
LogMessage( "Clip " + oClipCollection(i).FullName );
}
}
oMixer = oRoot.Mixer;
LogMessage( "List of clips retrieved from the container......." );
PrintClips( oMixer.Clips );
// Creating a compound clip from the clips created earlier
var myClips = new Array( oClip, oClip2 );
var oCompound = CreateCompound( oRoot, myClips );
LogMessage( "Compound clip " + oCompound.FullName );
LogMessage( "List of clips retrieved from the compound.......")
PrintClips( oCompound.Clips );
// Now retrieving once again the clips from under the mixer. This should only return the CompoundClip.
LogMessage( "List of clips retrieved from the mixer after the creation of the compound......." );
PrintClips( oMixer.Clips );
// Output of above script:
//INFO : First created clip Mixer.Mixer_Anim_Track.StoredStaticPose_Clip
//
//INFO : Second created clip Mixer.Mixer_Anim_Track1.StoredStaticPose1_Clip
//INFO : List of clips retrieved from the container.......
//INFO : Clip Mixer.Mixer_Anim_Track.StoredStaticPose_Clip
//INFO : Clip Mixer.Mixer_Anim_Track1.StoredStaticPose1_Clip
//
//INFO : Compound clip Mixer.Mixer_Anim_Track.CompoundAction_Clip
//INFO : List of clips retrieved from the compound.......
//INFO : Clip Mixer.Mixer_Anim_Track.CompoundAction_Clip.Mixer_Anim_Track3.StoredStaticPose_Clip
//INFO : Clip Mixer.Mixer_Anim_Track.CompoundAction_Clip.Mixer_Anim_Track4.StoredStaticPose1_Clip
//
//INFO : List of clips retrieved from the mixer after the creation of the compound.......
//INFO : Clip Mixer.Mixer_Anim_Track.CompoundAction_Clip
|