예제 #1
0
            protected override void BeginShow()
            {
                TrackTreeViewItem track = Owner as TrackTreeViewItem;

                _EditCurvesItem.IsVisible = track.TrackBar.IsContinuous;
                base.BeginShow();
            }
예제 #2
0
 public void DeleteTrack(TrackTreeViewItem track)
 {
     if (_Editor.Matinee != null)
     {
         if (UnityEditor.EditorUtility.DisplayDialog("Delete Track", "Are you sure you want to delete track : " + track.Track.gameObject.name, "Yes", "No"))
         {
             ((Skill.Framework.UI.Panel)track.Parent).Controls.Remove(track);
             Skill.Editor.UI.EditorFrame.RepaintParentEditorWindow(track);
             if (track.TrackBar != null)
             {
                 _Editor.TimeLine.View.Controls.Remove(track.TrackBar);
                 _Editor.CurveTracks.Remove(track.TrackBar);
             }
             GameObject.DestroyImmediate(track.Track.gameObject);
         }
     }
 }
예제 #3
0
        private void CreateTrack(TrackTreeViewGroup parent, TrackType type)
        {
            if (_Editor.Matinee != null)
            {
                GameObject   newObj   = new GameObject(string.Format("New{0}Track", type.ToString()));
                Track        newTrack = CreateNewTrack(newObj, type);
                BaseTrackBar bar      = CreateNewTrackBar(newTrack);

                _Editor.TimeLine.View.Controls.Add(bar);
                TrackTreeViewItem newItem = new TrackTreeViewItem(newTrack, bar);
                newItem.ContextMenu = _TrackItemContextMenu;

                newObj.transform.parent = parent.Group.transform;
                parent.Controls.Add(newItem);
                parent.Foldout.IsOpen = true;

                newObj.transform.localPosition = Vector3.zero;
                newObj.transform.localRotation = Quaternion.identity;
            }
        }
예제 #4
0
 public PropertyTrackProperties(TrackTreeViewItem item)
     : base(item)
 {
 }
예제 #5
0
 public TrackTreeViewItemPropertiesBase(TrackTreeViewItem item)
     : base(item.Track)
 {
     this.Item = item;
 }
예제 #6
0
            private void _DeleteItem_Click(object sender, System.EventArgs e)
            {
                TrackTreeViewItem track = Owner as TrackTreeViewItem;

                _View.DeleteTrack(track);
            }
예제 #7
0
            void _EditCurvesItem_Click(object sender, System.EventArgs e)
            {
                TrackTreeViewItem track = Owner as TrackTreeViewItem;

                MatineeEditorWindow.Instance.EditCurve(track.TrackBar);
            }
예제 #8
0
        private void Refresh(Transform transform, Skill.Framework.UI.Panel panel)
        {
            List <TrackGroup> groupList = new List <TrackGroup>();
            List <Track>      trackList = new List <Track>();

            int childCount = transform.childCount;

            // first check for any new group or track
            for (int childIndex = 0; childIndex < childCount; childIndex++)
            {
                Transform  childT = transform.GetChild(childIndex);
                TrackGroup group  = childT.GetComponent <TrackGroup>();
                if (group != null && !group.IsDestroyed)
                {
                    groupList.Add(group);

                    TrackTreeViewGroup groupItem = null;
                    foreach (var item in panel.Controls)
                    {
                        if (item is TrackTreeViewGroup)
                        {
                            if (((TrackTreeViewGroup)item).Group == group)
                            {
                                groupItem = (TrackTreeViewGroup)item;
                                break;
                            }
                        }
                    }

                    if (groupItem == null)
                    {
                        groupItem = new TrackTreeViewGroup(group);
                        groupItem.Foldout.Content.text = groupItem.Group.gameObject.name;
                        groupItem.ContextMenu          = _TrackGroupContextMenu;
                        panel.Controls.Add(groupItem);
                    }
                    //else
                    //groupItem.Refresh();
                    Refresh(groupItem.Group.transform, groupItem);

                    continue;
                }

                // if group not exist look for track
                Track track = childT.GetComponent <Track>();
                if (track != null && !track.IsDestroyed)
                {
                    trackList.Add(track);
                    TrackTreeViewItem trackItem = null;
                    foreach (var item in panel.Controls)
                    {
                        if (item is TrackTreeViewItem)
                        {
                            if (((TrackTreeViewItem)item).Track == track)
                            {
                                trackItem = (TrackTreeViewItem)item;
                                break;
                            }
                        }
                    }

                    if (trackItem == null)
                    {
                        BaseTrackBar bar = CreateNewTrackBar(track);
                        _Editor.TimeLine.View.Controls.Add(bar);
                        trackItem             = new TrackTreeViewItem(track, bar);
                        trackItem.ContextMenu = _TrackItemContextMenu;
                        panel.Controls.Add(trackItem);
                    }
                }
            }

            // now check for any deleted group or track
            int index = 0;

            while (index < panel.Controls.Count)
            {
                var item = panel.Controls[index];
                if (item is TrackTreeViewGroup)
                {
                    TrackGroup group = ((TrackTreeViewGroup)item).Group;
                    if (!groupList.Contains(group))
                    {
                        RemoveTracks((TrackTreeViewGroup)item);
                        panel.Controls.Remove(item);
                        continue;
                    }
                }
                else if (item is TrackTreeViewItem)
                {
                    Track track = ((TrackTreeViewItem)item).Track;
                    if (!trackList.Contains(track))
                    {
                        panel.Controls.Remove(item);
                        _Editor.TimeLine.View.Controls.Remove(((TrackTreeViewItem)item).TrackBar);
                        continue;
                    }
                }

                index++;
            }

            foreach (var item in Controls)
            {
                if (item is TrackTreeViewItem)
                {
                    ((TrackTreeViewItem)item).Refresh();
                }
            }
        }