Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[solved] Getting TrackClipType from a TrackAsset/ClipAsset

Discussion in 'Timeline' started by hoperin, Jul 18, 2018.

  1. hoperin


    Feb 9, 2014
    I'm setting up a system that duplicates my generated timelines and moves clips around depending on changes made during the generation process, which means I am iterating through all the tracks on a given Timeline, picking out the clips i want to migrate, and create new tracks and new clips on a new timeline.

    Where I'm stuck is getting from TrackAsset/TimelineClipAsset to TrackClipType, so that I can do multiple thigns, like exclude certain tracks, create new tracks on the new timeline of the correct track type, etc. I'm iterating through the tracks and the clips on said tracks with TimelineAsset.GetOutputTracks() and TrackAsset.GetClips() but these all target the Assets when really i need to find the type info at some point in this process.

    I'm actually unsure how to target TrackClipType at all. I tried track.TrackClipType, track.TrackClipType(), etc, but its unclear to me from the documentation what format this info is actually in / how to access it.

    Here's where I've gotten to:

    Code (CSharp):
    1.     void ClipMatchFound(TimelineClip oldClip, TimelineClip newClip) {
    3.         Debug.Log("MATCH FOUND FOR:" + oldClip.displayName + " in " + newClip.displayName);
    5.         //go thru each track on the old timeline we are copying form
    6.         foreach (TrackAsset track in oldTL.GetOutputTracks())
    7.         {
    8.             //does not currently work but find a way to skip the knot and ink clip tracks depending on their track type...
    9.             //if (track.Type != Ink_StateClipTrack)
    10.             //{
    12.             //go thru every dang clip on the track
    13.             foreach (TimelineClip clip in track.GetClips())
    14.                 {
    16.                 //if clip starts at exact same time
    17.                 if (clip.start == oldClip.start)
    18.                     {
    20.                         //copy the dang clip yall
    21.                         break;
    23.                         //else if clip is encapsulted by oldclip
    24.                     }
    25.                     else if (clip.start >= oldClip.start && (clip.start + clip.duration) <= (oldClip.start + oldClip.duration))
    26.                     {
    28.                         //copy the dang clip yall
    29.                         break;
    31.                     }
    32.                 }
    thanks in advance!
  2. hoperin


    Feb 9, 2014
    and of course as soon as i finally give in and make a forum post, i figure out the very easy solution. posting here for others:

    TrackAsset track;

    TimelineClip clip;

    will return the track type and clip type respectively
    Immu likes this.