internal TimelineClipSISData(TimelineClip owner) { m_clipOwner = owner; int numFrames = TimelineUtility.CalculateNumFrames(m_clipOwner); m_playableFrames = new List <SISPlayableFrame>(numFrames); }
//---------------------------------------------------------------------------------------------------------------------- internal void ResetPlayableFrames() { DestroyPlayableFrames(); //Recalculate the number of frames and create the marker's ground truth data int numFrames = TimelineUtility.CalculateNumFrames(m_clipOwner); m_playableFrames = new List <SISPlayableFrame>(numFrames); UpdatePlayableFramesSize(numFrames); }
//---------------------------------------------------------------------------------------------------------------------- //Resize PlayableFrames and used the previous values internal void RefreshPlayableFrames() { //Clip doesn't have parent. Might be because the clip is being moved if (null == m_clipOwner.parentTrack) { return; } int numIdealNumPlayableFrames = TimelineUtility.CalculateNumFrames(m_clipOwner); //Change the size of m_playableFrames and reinitialize if necessary int prevNumPlayableFrames = m_playableFrames.Count; if (numIdealNumPlayableFrames != prevNumPlayableFrames) { //Change the size of m_playableFrames and reinitialize if necessary List <bool> prevUsedFrames = new List <bool>(prevNumPlayableFrames); foreach (SISPlayableFrame frame in m_playableFrames) { prevUsedFrames.Add(null == frame || frame.IsUsed()); //if frame ==null, just regard as used. } UpdatePlayableFramesSize(numIdealNumPlayableFrames); //Reinitialize if (prevNumPlayableFrames > 0) { for (int i = 0; i < numIdealNumPlayableFrames; ++i) { int prevIndex = (int)(((float)(i) / numIdealNumPlayableFrames) * prevNumPlayableFrames); m_playableFrames[i].SetUsed(prevUsedFrames[prevIndex]); } } } //Refresh all markers double timePerFrame = TimelineUtility.CalculateTimePerFrame(m_clipOwner); int numPlayableFrames = m_playableFrames.Count; for (int i = 0; i < numPlayableFrames; ++i) { m_playableFrames[i].SetIndexAndLocalTime(i, i * timePerFrame); m_playableFrames[i].Refresh(m_frameMarkersVisibility); } }