示例#1
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;
                }
            }
        }
示例#2
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)
            {
                SeqenceWindow.inst.Repaint();
            }
        }
示例#3
0
        public static EditorClip InitClipObject(EditorTrack tr, IClip c)
        {
            var t     = GetClipAsset(c.GetType());
            var c_obj = t != null ? (EditorClip)Activator.CreateInstance(t) : new EditorClip();

            c_obj?.Init(tr, c);
            return(c_obj);
        }
示例#4
0
 public void Init(EditorTrack tr, IClip c)
 {
     this.track = tr;
     this.clip  = c;
     rect       = Rect.zero;
     dragMode   = DragMode.None;
     e          = Event.current;
     clipMode   = ClipMode.None;
     select     = false;
     Regist(EventT.Select, OnSelect);
 }
示例#5
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);
                }
            }
        }
示例#6
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)
            {
                SeqenceWindow.inst.Repaint();
            }
        }
示例#7
0
 private void DeleteTrack(EditorTrack etrack)
 {
     SeqenceWindow.inst.tree.RmTrack(etrack);
     etrack.track.Remove(SeqenceWindow.inst.seqence);
     SeqenceWindow.inst.seqence.RecalcuteDuration();
 }
示例#8
0
 public void SetSelect(EditorTrack track)
 {
     hierachy?.ForEach(x => x.trackF = x.Equals(track));
 }