ClipContainer.Tracks

Description

Returns a TrackCollection containing each Track object in the container.

C# Syntax

// get accessor
TrackCollection rtn = ClipContainer.Tracks;

Examples

Python Example

#
# This example demonstrates how to create tracks and retrieve all tracks 
# recursively under the ClipContainer using ClipContainer.Tracks.
# 
# The following hierarchy will be created:
#
# Mixer
#	|
#   +-Track (an animation track)
#   |   |
#   |   +-CompoundClip
#   |          |
#   |          +-Track4 (an animation track)
#   |
#   +-Track1 (an animation track)
#   |
#   +-Track2 (a shape track)
#   |
#   +-Track3 (an audio track)
#
#
Application.NewScene( None, False )
oRoot = Application.ActiveSceneRoot
oCube = oRoot.AddGeometry("Cube", "MeshSurface")	
# Creating the first animation source
sParams = "cube.kine.local.posx,cube.kine.local.posy,cube.kine.local.posz"
oSource = Application.StoreAction(oRoot, sParams, 1, "StoredStaticPose", 1, 1, 5, 0, 0)
# Creating the first clip
oClip = Application.AddClip(oRoot, oSource)	
Application.LogMessage("First created clip " + oClip.FullName )
Application.LogMessage("First created Track " + oClip.Parent.FullName )
oCube.Parameters("posx").Value  =  3.0
# Creating the second animation source
oSource2 = Application.StoreAction(oRoot, sParams, 1, "StoredStaticPose", 1, 7, 9, 0, 0)
# Creating the second clip
oClip2 = Application.AddClip(oRoot, oSource2)	
Application.LogMessage("Second created Clip " + oClip2.FullName)
Application.LogMessage("Second created Track " + oClip2.Parent.FullName)
# Adding a shape track
oMixer = oRoot.Mixer
oShapeTrack = Application.AddTrack(oRoot, oMixer, 1)
Application.LogMessage("Third created Track " + oShapeTrack.FullName )
# Adding an audio track
oAudioTrack = Application.AddTrack(oRoot, oMixer, 2)		
Application.LogMessage("Fourth created Track " + oAudioTrack.FullName)
# Creating a compound clip from the clips created earlier
# This implicitly creates a track for the nested clip
myClips = [oClip, oClip2]
oCompound = Application.CreateCompound(oRoot, myClips)
def FindTracksRecursively(in_oClipContainer):
	"This method returns an XSICollection containing the tracks which are nested under a ClipContainer"
	oReturnValue = XSIFactory.CreateActiveXObject("XSI.Collection")
	# First lets get the tracks which are directly under the container.
	oTracks = in_oClipContainer.Tracks
	for i in range(oTracks.Count):
		oReturnValue.Add(oTracks(i))
		oClips = oTracks(i).Clips
		for j in range(oClips.Count):
			if Application.ClassName(oClips(j)) == "CompoundClip" :
				oTracks2 = oClips(j).Tracks
				for k in range(oTracks2.Count):
					oReturnValue.Add(oTracks2(k))
	return oReturnValue
# Now retrieving all tracks recursively.
Application.LogMessage(FindTracksRecursively.__doc__)
oAllTracks = FindTracksRecursively(oRoot.Mixer)
Application.LogMessage("The resulting complete track list is the following: ")
for i in range(oAllTracks.Count):
	Application.LogMessage(oAllTracks(i).FullName)
# Output of the above script:
#INFO : First created clip Mixer.Mixer_Anim_Track.StoredStaticPose_Clip
#INFO : First created Track Mixer.Mixer_Anim_Track
#
#INFO : Second created Clip Mixer.Mixer_Anim_Track1.StoredStaticPose1_Clip
#INFO : Second created Track Mixer.Mixer_Anim_Track1
#
#INFO : Third created Track Mixer.Mixer_Shape_Track
#
#INFO : Fourth created Track Mixer.Mixer_Audio_Track
#
#INFO : This method returns an XSICollection containing the tracks which are nested under a ClipContainer
#INFO : The resulting complete track list is the following: 
#INFO : Mixer.Mixer_Anim_Track
#INFO : Mixer.Mixer_Anim_Track1
#INFO : Mixer.Mixer_Shape_Track
#INFO : Mixer.Mixer_Audio_Track