/// @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 Create a new timeline * @param owner Owner of this timeline */ public static FTimeline Create(Transform owner) { GameObject go = new GameObject(owner.name); FTimeline timeline = go.AddComponent <FTimeline>(); timeline.SetOwner(owner); return(timeline); }
/// @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 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) { for (int i = 0; i != _timelines.Count; ++i) { if (_timelines[i] == timeline) { Remove(i); break; } } }
// sets the timeline it belongs to, only to be called by FTimeline to avoid errors internal void SetTimeline(FTimeline timeline) { if (_timeline == timeline) { return; } _timeline = timeline; if (_timeline) { transform.parent = _timeline.transform; } else { transform.parent = null; } }
public void Rebuild() { _timelines.Clear(); Transform t = transform; for (int i = 0; i != t.childCount; ++i) { FTimeline timeline = t.GetChild(i).GetComponent <FTimeline>(); if (timeline != null) { // if( timeline.IsGlobal ) // _globalTimeline = timeline; // else _timelines.Add(timeline); timeline.SetContainer(this); timeline.Rebuild(); } } UpdateTimelineIds(); }
/// @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(); }