Example #1
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();
            }
        }
Example #2
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);
                }
            }
        }