Exemplo n.º 1
0
 public void Dispose()
 {
     hierachy?.Clear();
     track_idx   = 0;
     recordTrack = null;
     hierachy    = null;
 }
Exemplo n.º 2
0
        public void ShiftSelects(EditorTrack track)
        {
            int ix2 = -1;

            for (int i = 0; i < hierachy.Count; i++)
            {
                if (hierachy[i].@select)
                {
                    ix2 = i;
                    break;
                }
            }
            ResetSelect(false);
            if (ix2 < 0)
            {
                track.@select = true;
            }
            else
            {
                var ix1 = IndexOfTrack(track.track);
                int min = Mathf.Min(ix1, ix2);
                int len = Mathf.Abs(ix1 - ix2) + 1;
                for (int i = 0; i < len; i++)
                {
                    hierachy[min + i].@select = true;
                }
            }
        }
Exemplo n.º 3
0
        public void AddTrack(XTrack track, int idx, object arg = null, bool repaint = true)
        {
            EditorTrack etrack = EditorFactory.GetTrack(track);

            etrack.trackArg = arg;
            float y      = _y + WindowConstants.RawHeight * idx + WindowConstants.rowGap * idx;
            float offset = track.parent ? 10 : 0;
            var   rect   = new Rect(x, y, width, WindowConstants.RawHeight);
            var   head   = new Rect(offset, y, WindowConstants.sliderWidth - offset, WindowConstants.RawHeight);

            etrack.SetRect(head, rect);
            hierachy.Add(etrack);
            int last = hierachy.Count - 1;

            for (int i = last; i > idx; i--)
            {
                hierachy[i] = hierachy[i - 1];
                hierachy[i].YOffset(WindowConstants.RawHeight + WindowConstants.rowGap);
            }
            hierachy[idx] = etrack;
            if (repaint)
            {
                TimelineWindow.inst.Repaint();
            }
        }
Exemplo n.º 4
0
 public void SetRecordTrack(EditorTrack tck)
 {
     if (recordTrack)
     {
         recordTrack.track.SetFlag(TrackMode.Record, false);
     }
     recordTrack = tck;
 }
Exemplo n.º 5
0
 public EditorClip(EditorTrack tr, IClip c)
 {
     this.track = tr;
     this.clip  = c;
     rect       = Rect.zero;
     dragMode   = DragMode.None;
     e          = Event.current;
     clipMode   = ClipMode.None;
 }
Exemplo n.º 6
0
 public void SetSelect(EditorTrack track)
 {
     if (hierachy != null)
     {
         foreach (var it in hierachy)
         {
             bool s = it.Equals(track);
             it.trackF = s;
         }
     }
 }
Exemplo n.º 7
0
        private void Add(XTrack track, IList <EditorTrack> list)
        {
            EditorTrack etrack = EditorFactory.GetTrack(track);
            float       y      = _y + WindowConstants.RawHeight * track_idx + WindowConstants.rowGap * track_idx;
            int         offset = track.parent ? 10 : 0;
            var         rect   = new Rect(x, y, width, WindowConstants.RawHeight);
            var         head   = new Rect(offset, y, WindowConstants.sliderWidth - offset, WindowConstants.RawHeight);

            etrack.SetRect(head, rect);
            track_idx++;
            list.Add(etrack);
            if (track.childs != null)
            {
                for (int i = 0; i < track.childs.Length; i++)
                {
                    Add(track.childs[i], list);
                }
            }
        }
Exemplo n.º 8
0
        public void RmTrack(EditorTrack track, bool repaint = true)
        {
            int   ix    = -1;
            float delta = 0;

            for (int i = 0; i < hierachy.Count; i++)
            {
                var it = hierachy[i];
                if (it.ID == track.track.ID)
                {
                    ix    = i;
                    delta = track.rect.height + WindowConstants.rowGap;
                }
                it.YOffset(-delta);
            }
            if (ix >= 0)
            {
                hierachy.RemoveAt(ix);
            }
            if (repaint)
            {
                TimelineWindow.inst.Repaint();
            }
        }
Exemplo n.º 9
0
 private void DeleteTrack(EditorTrack etrack)
 {
     TimelineWindow.inst.tree.RmTrack(etrack);
     etrack.track.Remove(TimelineWindow.inst.timeline);
     TimelineWindow.inst.timeline.RecalcuteDuration();
 }