/// <summary> /// Compiles the subgraph of this timeline /// </summary> /// <param name="graph">The playable graph to inject the timeline.</param> /// <param name="timelinePlayable"></param> /// <param name="tracks">The list of tracks to compile</param> /// <param name="go">The GameObject that initiated the compilation</param> /// <param name="autoRebalance">In the editor, whether the graph should account for the possibility of changing clip times</param> /// <param name="createOutputs">Whether to create PlayableOutputs in the graph</param> public void Compile(PlayableGraph graph, Playable timelinePlayable, IEnumerable <TrackAsset> tracks, GameObject go, bool autoRebalance, bool createOutputs) { if (tracks == null) { throw new ArgumentNullException("Tracks list is null", "tracks"); } if (go == null) { throw new ArgumentNullException("GameObject parameter is null", "go"); } var outputTrackList = new List <TrackAsset>(tracks); var maximumNumberOfIntersections = outputTrackList.Count * 2 + outputTrackList.Count; // worse case: 2 overlapping clips per track + each track m_CurrentListOfActiveClips = new List <RuntimeElement>(maximumNumberOfIntersections); m_ActiveClips = new List <RuntimeElement>(maximumNumberOfIntersections); m_EvaluateCallbacks.Clear(); m_PlayableCache.Clear(); CompileTrackList(graph, timelinePlayable, outputTrackList, go, createOutputs); #if UNITY_EDITOR if (autoRebalance) { m_Rebalancer = new IntervalTreeRebalancer(m_IntervalTree); } #endif }
public void Compile(PlayableGraph graph, Playable timelinePlayable, IEnumerable <TrackAsset> tracks, GameObject go, bool autoRebalance, bool createOutputs) { if (tracks == null) { throw new ArgumentNullException("Tracks list is null", "tracks"); } if (go == null) { throw new ArgumentNullException("GameObject parameter is null", "go"); } List <TrackAsset> list = new List <TrackAsset>(tracks); int capacity = list.Count * 2 + list.Count; this.m_CurrentListOfActiveClips = new List <RuntimeElement>(capacity); this.m_ActiveClips = new List <RuntimeElement>(capacity); this.m_EvaluateCallbacks.Clear(); this.m_PlayableCache.Clear(); this.AllocateDefaultTracks(graph, timelinePlayable, list, go); this.CompileTrackList(graph, timelinePlayable, list, go, createOutputs); if (autoRebalance) { this.m_Rebalancer = new IntervalTreeRebalancer(this.m_IntervalTree); } }