Ejemplo n.º 1
0
        public void Add(BaseTrackBar trackBar)
        {
            // avoid edit same trackBar twice
            foreach (FolderView folder in _TreeView.Controls)
            {
                if ((BaseTrackBar)folder.UserData == trackBar)
                {
                    return;
                }
            }

            Curve.CurveEditor.EditCurveInfo[] curves = Curve.CurveEditor.GetCurves(trackBar.Track);
            if (curves != null && curves.Length > 0)
            {
                trackBar.IsEditingCurves = true;
                FolderView folder = new FolderView();
                folder.UserData             = trackBar;
                folder.Foldout.Content.text = trackBar.Track.gameObject.name;
                folder.Foldout.IsOpen       = true;
                folder.ContextMenu          = new CurveGroupContextMenu(this);

                int keyTypeValue = 1;
                foreach (var c in curves)
                {
                    CurveTrack             track = _CurveEditor.AddCurve(c.GetCurve(), c.Attribute.Color);
                    CurveTrackTreeViewItem item  = new CurveTrackTreeViewItem(c.Attribute.Name, track, trackBar, (KeyType)keyTypeValue);
                    folder.Controls.Add(item);
                    _TreeView.Controls.Add(folder);
                    keyTypeValue *= 2;
                }
            }
        }
Ejemplo n.º 2
0
 void _PresetPanel_PresetSelected(object sender, EventArgs e)
 {
     if (_PresetPanel.Preset != null && _CurveTreeView.SelectedItem != null && _CurveTreeView.SelectedItem is CurveTrackTreeViewItem)
     {
         CurveTrackTreeViewItem item = (CurveTrackTreeViewItem)_CurveTreeView.SelectedItem;
         while (item.Track.Curve.length > 0)
         {
             item.Track.Curve.RemoveKey(item.Track.Curve.length - 1);
         }
         for (int i = 0; i < _PresetPanel.Preset.Keys.Length; i++)
         {
             item.Track.Curve.AddKey(_PresetPanel.Preset.Keys[i]);
         }
         item.Track.RebuildKeys();
     }
 }
Ejemplo n.º 3
0
        private void AddCurves(Component component)
        {
            CurveEditor.EditCurveInfo[] curves = CurveEditor.GetCurves(component);
            if (curves != null && curves.Length > 0)
            {
                FolderView folder = new FolderView();
                folder.Foldout.Content.text = component.GetType().Name;
                folder.Foldout.IsOpen       = true;

                foreach (var c in curves)
                {
                    CurveTrack             track = _CurveEditor.AddCurve(c.GetCurve(), c.Attribute.Color);
                    CurveTrackTreeViewItem item  = new CurveTrackTreeViewItem(track, c);
                    folder.Controls.Add(item);
                }

                _CurveTreeView.Controls.Add(folder);
            }
        }