Search Unity

Targeting current TimelineClip from MixerBehaviour

Discussion in 'Timeline' started by hoperin, May 8, 2018.

  1. hoperin

    hoperin

    Joined:
    Feb 9, 2014
    Posts:
    52
    I've run into a fairly straight forward but sticky spot working with Timeline. I thought I finally had a complete grasp on how to access the many different moving parts but it seems not! I'm trying to access the TimelineClip reference of the current clip from the mixer (so that I can pass the .start and .end times of said clip onwards).

    While I know to cast one way:
    Ink_StateBehavior input = Timelineclip tClip.asset as Ink_StateBehavior
    I dont' know how to do the reverse:
    TimelineClip tClip = ?????? as TimelineClip

    I suspect is has to do with the playable reference? but I'm lost on that...
    thanks in advance!

    Code (CSharp):
    1. public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    2.     {
    3.  
    4.         double secs = playable.GetGraph ().GetRootPlayable (0).GetTime ();
    5.         int inputCount = playable.GetInputCount ();
    6.  
    7.         for (int i = 0; i < inputCount; i++)
    8.         {
    9.             float inputWeight = playable.GetInputWeight(i);
    10.  
    11.             ScriptPlayable<Ink_StateBehaviour> inputPlayable = (ScriptPlayable<Ink_StateBehaviour>)playable.GetInput(i);
    12.             Ink_StateBehaviour input = inputPlayable.GetBehaviour ();
    13.  
    14.             if (inputWeight == 0) {
    15.                 input.played = false;
    16.             }
    17.  
    18.             if (inputWeight > 0 && !input.played) {
    19.                
    20.                     input.played = true;
    21.                     Scr_InkMaster ink = GameObject.Find ("InkMaster").GetComponent<Scr_InkMaster> ();
    22.                     ink.WipeSpeech ();
    23.                     ink.ResetCallStack ();
    24.                     ink.EditorJumpTo (input.state, input.advance, input.content, input.isChoice);
    25.  
    26.                 /////TimelineClip tclip = ????????????
    27.                     director.time = tclip.start;
    28.                     ink.GetComponent<Scr_ClipList> ().currentClipEnd = tclip.end;
    29.             }
    30.         }
    31.     }        
     
  2. hoperin

    hoperin

    Joined:
    Feb 9, 2014
    Posts:
    52
    I've so far only seen this fix, but it seems really janky to have to do this from the mixer...