示例#1
0
        private void DeselectEvent(FEventEditor eventEditor)
        {
            if (eventEditor == null || !eventEditor.IsSelected())
            {
                return;
            }

            Undo.RegisterCompleteObjectUndo(new Object[] { eventEditor, this }, "deselect Event");

            _selectedEvents.Remove(eventEditor);
            FInspectorWindow.SetEvents(_selectedEvents);

            eventEditor.OnDeselect();
        }
示例#2
0
        private void SelectEvent(FEventEditor eventEditor)
        {
            if (eventEditor == null || eventEditor.IsSelected())
            {
                return;
            }

            SelectTrack(eventEditor._trackEditor);
            Undo.RegisterCompleteObjectUndo(new Object[] { eventEditor, this }, "select Event");

            _selectedEvents.Add(eventEditor);
            FInspectorWindow.SetEvents(_selectedEvents);

            eventEditor.OnSelect();
        }
示例#3
0
        public void MoveEvents(int deltaFrames)
        {
            bool movingLeft = deltaFrames < 0;

            int howMuchCanMove = int.MaxValue;

            for (int i = 0; i != _selectedTracks.Count; ++i)
            {
                if (movingLeft)
                {
                    for (int j = 0; j != _selectedTracks[i]._eventEditors.Count; ++j)
                    {
                        FEventEditor evtEditor = _selectedTracks[i]._eventEditors[j];
                        if (evtEditor.IsSelected())
                        {
                            if (j == 0)
                            {
                                howMuchCanMove = Mathf.Min(howMuchCanMove, evtEditor._evt.Start);
                            }
                            else if (!_selectedTracks[i]._eventEditors[j - 1].IsSelected())
                            {
                                howMuchCanMove = Mathf.Min(howMuchCanMove, evtEditor._evt.Start - _selectedTracks[i]._eventEditors[j - 1]._evt.End);
                            }
                        }
                    }
                }
                else
                {
                    int lastElementIndex = _selectedTracks[i]._eventEditors.Count - 1;
                    for (int j = lastElementIndex; j != -1; --j)
                    {
                        FEventEditor evtEditor = _selectedTracks[i]._eventEditors[j];
                        if (evtEditor.IsSelected())
                        {
                            if (j == lastElementIndex)
                            {
                                howMuchCanMove = Mathf.Min(howMuchCanMove, _sequence.Length - evtEditor._evt.End);
                            }
                            else if (!_selectedTracks[i]._eventEditors[j + 1].IsSelected())
                            {
                                howMuchCanMove = Mathf.Min(howMuchCanMove, _selectedTracks[i]._eventEditors[j + 1]._evt.Start - evtEditor._evt.End);
                            }
                        }
                    }
                }
            }

            if (movingLeft)
            {
                howMuchCanMove = -howMuchCanMove;
                deltaFrames    = Mathf.Clamp(deltaFrames, howMuchCanMove, 0);
            }
            else
            {
                deltaFrames = Mathf.Clamp(deltaFrames, 0, howMuchCanMove);
            }

            if (deltaFrames != 0)
            {
                for (int i = 0; i != _selectedEvents.Count; ++i)
                {
                    Undo.RecordObject(_selectedEvents[i]._evt, "move Event");
                    _selectedEvents[i]._evt.Start += deltaFrames;
                    _selectedEvents[i]._evt.End   += deltaFrames;
                    EditorUtility.SetDirty(_selectedEvents[i]._evt);
                }
            }
        }