/// @brief Removes timeline and updates their ids. /// @param timeline CTimeline to remove. /// @note After calling this function, the ids of the timelines after this /// one in the list will have an id smaller by 1. public void Remove(FTimeline timeline) { _timelines.Remove(timeline); timeline.SetSequence(null); UpdateTimelineIds(); }
/// @brief Removes timeline with id. /// @oaram id Id of the CTimeline to remove. /// @note After calling this function, the ids of the timelines after this /// one in the list will have an id smaller by 1. /// @warning Does not check if id is valid (i.e. between -1 & GetTimelines().Count) public void Remove(int id) { FTimeline timeline = _timelines[id]; _timelines.RemoveAt(id); timeline.SetSequence(null); UpdateTimelineIds(); }
/// @brief Adds new timeline at the end of the list. /// @param timeline New timeline. public void Add(FTimeline timeline) { int id = _timelines.Count; _timelines.Add(timeline); timeline.SetId(id); timeline.SetSequence(this); }
/// @brief Rebuilds the sequence. This is to be called whenever timelines, /// tracks, or events are added / removed from the sequence. /// @note You should only call this in editor mode, avoid calling it at runtime. public void Rebuild() { #if FLUX_DEBUG Debug.Log("Rebuilding"); #endif Transform t = TimelineContainer; _timelines.Clear(); for (int i = 0; i != t.childCount; ++i) { FTimeline timeline = t.GetChild(i).GetComponent <FTimeline>(); if (timeline) { _timelines.Add(timeline); timeline.SetSequence(this); timeline.Rebuild(); } } UpdateTimelineIds(); }