Example #1
0
        public void OnGUI()
        {
            FrameRange viewRange = _window.GetSequenceEditor().ViewRange;

            GUI.backgroundColor = Color.white;
            GUI.contentColor    = FGUI.GetTextColor();
            GUIStyle numberFieldStyle = new GUIStyle(EditorStyles.numberField);

            numberFieldStyle.alignment = TextAnchor.MiddleCenter;

            if (_showViewRange)
            {
                EditorGUI.PrefixLabel(_viewRangeLabelRect, _viewRangeLabel);
                EditorGUI.BeginChangeCheck();
                viewRange.Start = EditorGUI.IntField(_viewRangeStartRect, viewRange.Start, numberFieldStyle);
                EditorGUI.PrefixLabel(_viewRangeDashRect, _viewRangeDash);
                viewRange.End = EditorGUI.IntField(_viewRangeEndRect, viewRange.End, numberFieldStyle);
                if (EditorGUI.EndChangeCheck())
                {
                    _window.GetSequenceEditor().SetViewRange(viewRange);
                }
            }
        }
Example #2
0
//		private float _speed = 1f;
//
//		public float Speed
//		{
//			set
//			{
//				_speed = value;
//
//				_speedIndex = 0;
////				float distance = float.MaxValue;
//				for( int i = 1; i != _speedValues.Length; ++i )
//				{
//					if( Mathf.Approximately( _speed, _speedValues[i] ) )
//					{
//						_speedIndex = i;
//						break;
//					}
////					if( Mathf.Abs( speed - _speedValues[i] ) < distance )
////					{
////						distance = Mathf.Abs( speed - _speedValues[i] );
////						_speedIndex = i;
////					}
//				}
//
//				if( _speedIndex > 0 )
//					_window.GetSequenceEditor().GetSequence().Speed = _speedValues[_speedIndex] * (_window.GetSequenceEditor().IsPlayingForward ? 1f : -1f);
//				else
//					_speedValueStrs[0].text = _speed.ToString("0.00")+'x';
//			}
//		}

        public void OnGUI()
        {
            FSequence  sequence  = _window.GetSequenceEditor().Sequence;
            FrameRange viewRange = _window.GetSequenceEditor().ViewRange;

            GUI.backgroundColor = Color.white;
            GUI.contentColor    = FGUI.GetTextColor();

            bool goToFirst    = false;
            bool goToPrevious = false;
            bool goToNext     = false;
            bool goToLast     = false;

            if (Event.current.type == EventType.KeyDown)
            {
                if (Event.current.keyCode == KeyCode.Comma)
                {
                    goToFirst    = Event.current.shift;
                    goToPrevious = !goToFirst;
                    Event.current.Use();
                    _window.Repaint();
                }

                if (Event.current.keyCode == KeyCode.Period)
                {
                    goToLast = Event.current.shift;
                    goToNext = !goToLast;
                    Event.current.Use();
                    _window.Repaint();
                }
            }

            if (GUI.Button(_firstFrameButtonRect, _firstFrame, EditorStyles.miniButtonLeft) || goToFirst)
            {
                GoToFrame(viewRange.Start);
            }

            if (GUI.Button(_previousFrameButtonRect, _previousFrame, EditorStyles.miniButtonMid) || goToPrevious)
            {
                GoToFrame(viewRange.Cull(sequence.CurrentFrame - 1));
            }

            GUIStyle numberFieldStyle = new GUIStyle(EditorStyles.numberField);

            numberFieldStyle.alignment = TextAnchor.MiddleCenter;

//			Debug.Log("hot control: " + EditorGUIUtility.hotControl + " keyboard control: " + EditorGUIUtility.keyboardControl );

            if (sequence != null)
            {
                if (sequence.CurrentFrame < 0)
                {
                    EditorGUI.BeginChangeCheck();
                    string frameStr = EditorGUI.TextField(_currentFrameFieldRect, string.Empty, numberFieldStyle);
                    if (EditorGUI.EndChangeCheck())
                    {
                        int newCurrentFrame = 0;
                        int.TryParse(frameStr, out newCurrentFrame);
                        newCurrentFrame = Mathf.Clamp(newCurrentFrame, 0, sequence.Length);
                        _window.GetSequenceEditor().SetCurrentFrame(newCurrentFrame);
                    }
                }
                else
                {
                    EditorGUI.BeginChangeCheck();
                    int newCurrentFrame = Mathf.Clamp(EditorGUI.IntField(_currentFrameFieldRect, sequence.CurrentFrame, numberFieldStyle), 0, sequence.Length);
                    if (EditorGUI.EndChangeCheck())
                    {
                        _window.GetSequenceEditor().SetCurrentFrame(newCurrentFrame);
                    }
                }
            }

            if (GUI.Button(_nextFrameButtonRect, _nextFrame, EditorStyles.miniButtonMid) || goToNext)
            {
                GoToFrame(viewRange.Cull(sequence.CurrentFrame + 1));
            }

            if (GUI.Button(_lastFrameButtonRect, _lastFrame, EditorStyles.miniButtonRight) || goToLast)
            {
                GoToFrame(viewRange.End);
            }

//			if( GUI.Button( _playBackwardButtonRect, isPlaying ? _pause : _playBackward, EditorStyles.miniButtonLeft ) )
//			{
//				if( isPlaying )
//					Pause();
//				else
//					PlayBackwards();
//			}

            if (GUI.Button(_stopButtonRect, _stop, EditorStyles.miniButtonLeft))
            {
                Stop();
            }

            if (Event.current.type == EventType.MouseUp && _playForwardButtonRect.Contains(Event.current.mousePosition))
            {
                _window.GetSequenceEditor().IsPlayingForward = Event.current.button == 0;
            }

            bool isPlaying        = Application.isPlaying ? _window.GetSequenceEditor().Sequence.IsPlaying : _window.GetSequenceEditor().IsPlaying;
            bool isPlayingForward = _window.GetSequenceEditor().IsPlayingForward;

            if (GUI.Button(_playForwardButtonRect, isPlaying ? _pause : (isPlayingForward ? _playForward : _playBackward), EditorStyles.miniButtonRight))
            {
                if (isPlaying)
                {
                    Pause();
                }
                else if (isPlayingForward)
                {
                    Play();
                }
                else
                {
                    PlayBackwards();
                }
            }

            if (_showSpeedSlider)
            {
                GUI.Label(_speedLabelRect, _speedLabel);

                float currentSpeed = Mathf.Abs(_window.GetSequenceEditor().Sequence.Speed);
                EditorGUI.BeginChangeCheck();
                float speed = GUI.HorizontalSlider(_speedSliderRect, currentSpeed, _speedValues[0], _speedValues[_speedValues.Length - 1]);
                if (EditorGUI.EndChangeCheck())
                {
                    int   speedIndex = 0;
                    float distance   = float.MaxValue;
                    for (int i = 0; i != _speedValues.Length; ++i)
                    {
                        if (Mathf.Abs(speed - _speedValues[i]) < distance)
                        {
                            distance   = Mathf.Abs(speed - _speedValues[i]);
                            speedIndex = i;
                        }
                    }
//					Speed = _speedValues[_speedIndex];
                    _window.GetSequenceEditor().Sequence.Speed = _speedValues[speedIndex] * (isPlayingForward ? 1f : -1f);
                }
//				if( !Mathf.Approximately(speed, currentSpeed) )
//				{
//					_speedIndex = 0;
//					float distance = float.MaxValue;
//					for( int i = 0; i != _speedValues.Length; ++i )
//					{
//						if( Mathf.Abs( speed - _speedValues[i] ) < distance )
//						{
//							distance = Mathf.Abs( speed - _speedValues[i] );
//							_speedIndex = i;
//						}
//					}
//					_window.GetSequenceEditor().GetSequence().Speed = _speedValues[_speedIndex] * (isPlayingForward ? 1f : -1f);
//				}

//				GUI.Label( _speedValueRect, _speedValueStrs[_speedIndex] );
                EditorGUI.BeginChangeCheck();
                speed = Mathf.Abs(EditorGUI.FloatField(_speedValueRect, currentSpeed));
                if (EditorGUI.EndChangeCheck())
                {
                    _window.GetSequenceEditor().Sequence.Speed = speed * (isPlayingForward ? 1f : -1f);
                }
            }

            if (_showViewRange)
            {
                EditorGUI.PrefixLabel(_viewRangeLabelRect, _viewRangeLabel);

                EditorGUI.BeginChangeCheck();

                viewRange.Start = EditorGUI.IntField(_viewRangeStartRect, viewRange.Start, numberFieldStyle);

                EditorGUI.PrefixLabel(_viewRangeDashRect, _viewRangeDash);

                viewRange.End = EditorGUI.IntField(_viewRangeEndRect, viewRange.End, numberFieldStyle);

                if (EditorGUI.EndChangeCheck())
                {
                    _window.GetSequenceEditor().SetViewRange(viewRange);
                }
            }
        }
        public void OnGUI()
        {
            FSequence sequence = _sequenceWindow.GetSequenceEditor().GetSequence();

            if (_selectedSequenceIndex < 0 && sequence != null)
            {
                for (int i = 0; i != _sequences.Length; ++i)
                {
                    if (_sequences[i] == sequence)
                    {
                        _selectedSequenceIndex = i;
                        break;
                    }
                }
            }


            GUI.contentColor = FGUI.GetTextColor();

            if (Event.current.type == EventType.MouseDown && Event.current.alt && _sequencePopupRect.Contains(Event.current.mousePosition))
            {
                Selection.activeObject = sequence;
                Event.current.Use();
            }

            EditorGUI.BeginChangeCheck();
            EditorGUI.PrefixLabel(_sequenceLabelRect, _sequenceLabel);
            int newSequenceIndex = EditorGUI.Popup(_sequencePopupRect, _selectedSequenceIndex, _sequenceNames);

            if (EditorGUI.EndChangeCheck())
            {
                _selectedSequenceIndex = newSequenceIndex;
                _sequenceWindow.GetSequenceEditor().OpenSequence(_sequences[_selectedSequenceIndex]);
                _sequenceWindow.RemoveNotification();
                EditorGUIUtility.keyboardControl = 0;                 // deselect it
                EditorGUIUtility.ExitGUI();
            }

            if (GUI.Button(_sequenceAddButtonRect, new GUIContent((Texture2D)AssetDatabase.LoadAssetAtPath(FUtility.GetFluxSkinPath() + "Plus.png", typeof(Texture2D)), "Create New Sequence.."), EditorStyles.label))
            {
                FSequence newSequence = FSequenceEditorWindow.CreateSequence();
                _sequenceWindow.GetSequenceEditor().OpenSequence(newSequence);
                EditorGUIUtility.ExitGUI();
            }

            if (sequence == null)
            {
                return;
            }

            if (_sequenceSO == null || _sequenceSO.targetObject != sequence)
            {
                _sequenceSO         = new SerializedObject(sequence);
                _sequenceUpdateMode = _sequenceSO.FindProperty("_updateMode");
                _sequenceLength     = _sequenceSO.FindProperty("_length");
            }

            _sequenceSO.Update();

            if (_showUpdadeMode)
            {
                EditorGUI.PrefixLabel(_updateModeLabelRect, _updateModeLabel);
                EditorGUI.PropertyField(_updateModeFieldRect, _sequenceUpdateMode, GUIContent.none);
            }

            if (_showFramerate)
            {
                EditorGUI.PrefixLabel(_framerateLabelRect, _framerateLabel);
                EditorGUI.BeginChangeCheck();
                int newFrameRate = FGUI.FrameRatePopup(_framerateFieldRect, sequence.FrameRate);
                if (EditorGUI.EndChangeCheck())
                {
                    if (newFrameRate == -1)
                    {
                        FChangeFrameRateWindow.Show(new Vector2(_framerateLabelRect.xMin, _framerateLabelRect.yMax), sequence, FSequenceInspector.Rescale);
                    }
                    else
                    {
                        FSequenceInspector.Rescale(sequence, newFrameRate, true);
                    }
                }
            }

            if (_showLength)
            {
                EditorGUI.PrefixLabel(_lengthLabelRect, _lengthLabel);
                _sequenceLength.intValue = EditorGUI.IntField(_lengthFieldRect, _sequenceLength.intValue, _numberFieldStyle);
            }

            _sequenceSO.ApplyModifiedProperties();
        }
Example #4
0
        public void OnGUI()
        {
            FSequence  sequence  = _window.GetSequenceEditor().GetSequence();
            FrameRange viewRange = _window.GetSequenceEditor().GetViewRange();

            GUI.contentColor = FGUI.GetTextColor();

            bool goToFirst    = false;
            bool goToPrevious = false;
            bool goToNext     = false;
            bool goToLast     = false;

            if (Event.current.type == EventType.KeyDown)
            {
                if (Event.current.keyCode == KeyCode.Comma)
                {
                    goToFirst    = Event.current.shift;
                    goToPrevious = !goToFirst;
                    Event.current.Use();
                    _window.Repaint();
                }

                if (Event.current.keyCode == KeyCode.Period)
                {
                    goToLast = Event.current.shift;
                    goToNext = !goToLast;
                    Event.current.Use();
                    _window.Repaint();
                }
            }

            if (GUI.Button(_firstFrameButtonRect, _firstFrame, EditorStyles.miniButtonLeft) || goToFirst)
            {
                GoToFrame(viewRange.Start);
            }

            if (GUI.Button(_previousFrameButtonRect, _previousFrame, EditorStyles.miniButtonMid) || goToPrevious)
            {
                GoToFrame(viewRange.Cull(sequence.GetCurrentFrame() - 1));
            }

            GUIStyle numberFieldStyle = new GUIStyle(EditorStyles.numberField);

            numberFieldStyle.alignment = TextAnchor.MiddleCenter;

//			Debug.Log("hot control: " + EditorGUIUtility.hotControl + " keyboard control: " + EditorGUIUtility.keyboardControl );

            if (sequence != null)
            {
                if (sequence.GetCurrentFrame() < 0)
                {
                    EditorGUI.BeginChangeCheck();
                    string frameStr = EditorGUI.TextField(_currentFrameFieldRect, string.Empty, numberFieldStyle);
                    if (EditorGUI.EndChangeCheck())
                    {
                        int newCurrentFrame = 0;
                        int.TryParse(frameStr, out newCurrentFrame);
                        newCurrentFrame = Mathf.Clamp(newCurrentFrame, 0, sequence.Length);
                        _window.GetSequenceEditor().SetCurrentFrame(newCurrentFrame);
                    }
                }
                else
                {
                    EditorGUI.BeginChangeCheck();
                    int newCurrentFrame = Mathf.Clamp(EditorGUI.IntField(_currentFrameFieldRect, sequence.GetCurrentFrame(), numberFieldStyle), 0, sequence.Length);
                    if (EditorGUI.EndChangeCheck())
                    {
                        _window.GetSequenceEditor().SetCurrentFrame(newCurrentFrame);
                    }
                }
            }

            if (GUI.Button(_nextFrameButtonRect, _nextFrame, EditorStyles.miniButtonMid) || goToNext)
            {
                GoToFrame(viewRange.Cull(sequence.GetCurrentFrame() + 1));
            }

            if (GUI.Button(_lastFrameButtonRect, _lastFrame, EditorStyles.miniButtonRight) || goToLast)
            {
                GoToFrame(viewRange.End);
            }

//			if( GUI.Button( _playBackwardButtonRect, _window.IsPlaying ? "[] Stop" : "< Play", EditorStyles.miniButtonLeft) )
//			{
//				if( _window.IsPlaying )
//				{
//					_window.Stop();
//				}
//				else
//				{
//					_window.Play();
//				}
//			}

            if (GUI.Button(_stopButtonRect, _stop, EditorStyles.miniButtonLeft))
            {
                Stop();
            }

            if (GUI.Button(_playForwardButtonRect, _window.IsPlaying ? _pause : _playForward, EditorStyles.miniButtonRight))
            {
                if (_window.IsPlaying)
                {
                    Pause();
                }
                else
                {
                    Play();
                }
            }


            if (_showViewRange)
            {
                EditorGUI.PrefixLabel(_viewRangeLabelRect, _viewRangeLabel);

                EditorGUI.BeginChangeCheck();

                viewRange.Start = EditorGUI.IntField(_viewRangeStartRect, viewRange.Start, numberFieldStyle);

                EditorGUI.PrefixLabel(_viewRangeDashRect, _viewRangeDash);

                viewRange.End = EditorGUI.IntField(_viewRangeEndRect, viewRange.End, numberFieldStyle);

                if (EditorGUI.EndChangeCheck())
                {
                    _window.GetSequenceEditor().SetViewRange(viewRange);
                }
            }
        }
Example #5
0
        public void OnGUI()
        {
            FSequence sequence = _sequenceWindow.GetSequenceEditor().Sequence;

            if ((_selectedSequenceIndex < 0 && sequence != null) || (_selectedSequenceIndex >= 0 && _sequences[_selectedSequenceIndex] != sequence))
            {
                for (int i = 0; i != _sequences.Length; ++i)
                {
                    if (_sequences[i] == sequence)
                    {
                        _selectedSequenceIndex = i;
                        break;
                    }
                }
            }


            if (Event.current.type == EventType.MouseDown && Event.current.alt && _sequencePopupRect.Contains(Event.current.mousePosition))
            {
                Selection.activeObject = sequence;
                Event.current.Use();
            }

            EditorGUI.BeginChangeCheck();
            EditorGUI.PrefixLabel(_sequenceLabelRect, _sequenceLabel);
            int newSequenceIndex = EditorGUI.Popup(_sequencePopupRect, _selectedSequenceIndex, _sequenceNames);

            if (EditorGUI.EndChangeCheck())
            {
                if (newSequenceIndex == _sequenceNames.Length - 1)
                {
                    FSequence newSequence = FSequenceEditorWindow.CreateSequence();
                    Selection.activeTransform = newSequence.transform;
                    _sequenceWindow.GetSequenceEditor().OpenSequence(newSequence);
                }
                else
                {
                    _selectedSequenceIndex = newSequenceIndex;
                    _sequenceWindow.GetSequenceEditor().OpenSequence(_sequences[_selectedSequenceIndex]);
                    _sequenceWindow.RemoveNotification();
                }
                EditorGUIUtility.keyboardControl = 0; // deselect it
                EditorGUIUtility.ExitGUI();
            }

            // if we're in play mode, can't change anything
            if (Application.isPlaying)
            {
                GUI.enabled = false;
            }

            if (sequence == null)
            {
                return;
            }

            if (_sequenceSO == null || _sequenceSO.targetObject != sequence)
            {
                _sequenceSO          = new SerializedObject(sequence);
                _sequenceExecuteTime = _sequenceSO.FindProperty("_executeTime");
                _sequenceUpdateMode  = _sequenceSO.FindProperty("_updateMode");
                _sequenceLength      = _sequenceSO.FindProperty("_length");
            }

            _sequenceSO.Update();

            if (_showExecuteTime)
            {
                EditorGUI.PrefixLabel(_executeTimeLabelRect, _executeTimeLabel);
                //EditorGUI.PropertyField(_executeTimeFieldRect, _sequenceExecuteTime, _numberFieldStyle);
                _sequenceExecuteTime.intValue = EditorGUI.IntField(_executeTimeFieldRect, _sequenceExecuteTime.intValue, _numberFieldStyle);
            }

            if (_showUpdadeMode)
            {
                EditorGUI.PrefixLabel(_updateModeLabelRect, _updateModeLabel);
                EditorGUI.PropertyField(_updateModeFieldRect, _sequenceUpdateMode, GUIContent.none);
            }

            if (_showFramerate)
            {
                EditorGUI.PrefixLabel(_framerateLabelRect, _framerateLabel);
                EditorGUI.BeginChangeCheck();
                int newFrameRate = FGUI.FrameRatePopup(_framerateFieldRect, sequence.FrameRate);
                if (EditorGUI.EndChangeCheck())
                {
                    if (newFrameRate == -1)
                    {
                        FChangeFrameRateWindow.Show(new Vector2(_framerateLabelRect.xMin, _framerateLabelRect.yMax), sequence, FSequenceInspector.Rescale);
                    }
                    else
                    {
                        FSequenceInspector.Rescale(sequence, newFrameRate, true);
                    }
                }
            }

            if (_showLength)
            {
                EditorGUI.PrefixLabel(_lengthLabelRect, _lengthLabel);
                _sequenceLength.intValue = Mathf.Clamp(EditorGUI.IntField(_lengthFieldRect, _sequenceLength.intValue, _numberFieldStyle), 1, int.MaxValue);
            }

            GUIStyle s = new GUIStyle(EditorStyles.miniButton);

            s.padding = new RectOffset(1, 1, 1, 1);

            if (_showAddContainer)
            {
                if (FGUI.Button(_addContainerRect, _addContainerLabel))
                {
                    AddContainer();
                }
            }

            if (FGUI.Button(_openInspectorRect, _openInspectorLabel))
            {
                FInspectorWindow.Open();
            }

            _sequenceSO.ApplyModifiedProperties();

            GUI.enabled = true;
        }
Example #6
0
        public void OnGUI()
        {
            FSequence sequence = _sequenceWindow.GetSequenceEditor().Sequence;

            if ((_selectedSequenceIndex < 0 && sequence != null) || (_selectedSequenceIndex >= 0 && _sequences[_selectedSequenceIndex] != sequence))
            {
                for (int i = 0; i != _sequences.Length; ++i)
                {
                    if (_sequences[i] == sequence)
                    {
                        _selectedSequenceIndex = i;
                        break;
                    }
                }
            }


//			GUI.contentColor = FGUI.GetTextColor();

            if (Event.current.type == EventType.MouseDown && Event.current.alt && _sequencePopupRect.Contains(Event.current.mousePosition))
            {
                Selection.activeObject = sequence;
                Event.current.Use();
            }

            EditorGUI.BeginChangeCheck();
            EditorGUI.PrefixLabel(_sequenceLabelRect, _sequenceLabel);
            int newSequenceIndex = EditorGUI.Popup(_sequencePopupRect, _selectedSequenceIndex, _sequenceNames);

            if (EditorGUI.EndChangeCheck())
            {
                if (newSequenceIndex == _sequenceNames.Length - 1)
                {
                    FSequence newSequence = FSequenceEditorWindow.CreateSequence();
                    Selection.activeTransform = newSequence.transform;
                    _sequenceWindow.GetSequenceEditor().OpenSequence(newSequence);
                }
                else
                {
                    _selectedSequenceIndex = newSequenceIndex;
                    _sequenceWindow.GetSequenceEditor().OpenSequence(_sequences[_selectedSequenceIndex]);
                    _sequenceWindow.RemoveNotification();
                }
                EditorGUIUtility.keyboardControl = 0;                 // deselect it
                EditorGUIUtility.ExitGUI();
            }

            // if we're in play mode, can't change anything
            if (Application.isPlaying)
            {
                GUI.enabled = false;
            }

            if (sequence == null)
            {
                return;
            }

            if (_sequenceSO == null || _sequenceSO.targetObject != sequence)
            {
                _sequenceSO         = new SerializedObject(sequence);
                _sequenceUpdateMode = _sequenceSO.FindProperty("_updateMode");
                _sequenceLength     = _sequenceSO.FindProperty("_length");
            }

            _sequenceSO.Update();

            if (_showUpdadeMode)
            {
                EditorGUI.PrefixLabel(_updateModeLabelRect, _updateModeLabel);
                EditorGUI.PropertyField(_updateModeFieldRect, _sequenceUpdateMode, GUIContent.none);
            }

            if (_showFramerate)
            {
                EditorGUI.PrefixLabel(_framerateLabelRect, _framerateLabel);
                EditorGUI.BeginChangeCheck();
                int newFrameRate = FGUI.FrameRatePopup(_framerateFieldRect, sequence.FrameRate);
                if (EditorGUI.EndChangeCheck())
                {
                    if (newFrameRate == -1)
                    {
                        FChangeFrameRateWindow.Show(new Vector2(_framerateLabelRect.xMin, _framerateLabelRect.yMax), sequence, FSequenceInspector.Rescale);
                    }
                    else
                    {
                        FSequenceInspector.Rescale(sequence, newFrameRate, true);
                    }
                }
            }

//			FSequenceEditor sequenceEditor = _sequenceWindow.GetSequenceEditor();

            // if it gets resized, we need to set the view range a
//			bool setViewRange = false;

//			FrameRange viewRange = sequenceEditor.GetViewRange();

            if (_showLength)
            {
                EditorGUI.PrefixLabel(_lengthLabelRect, _lengthLabel);
//				EditorGUI.BeginChangeCheck();
                _sequenceLength.intValue = Mathf.Clamp(EditorGUI.IntField(_lengthFieldRect, _sequenceLength.intValue, _numberFieldStyle), 1, int.MaxValue);

//				if( EditorGUI.EndChangeCheck() )
//				{
//					float viewRangePercentage = (float)viewRange.Length / sequenceEditor.GetSequence().Length;
//
//					if( viewRange.End > _sequenceLength.intValue )
//					{
//						viewRange.End = _sequenceLength.intValue;
//						if( viewRange.Start > viewRange.End )
//						{
//							viewRange.Start = viewRange.End;
//						}
//					}
//					else
//					{
//						viewRange.End = Mathf.Clamp( viewRange.Start + Mathf.RoundToInt(_sequenceLength.intValue * viewRangePercentage), viewRange.Start, _sequenceLength.intValue );
//					}
//
//					setViewRange = true;
//				}
            }

            if (_showAddContainer)
            {
                if (GUI.Button(_addContainerRect, _addContainerLabel, EditorStyles.label))
                {
                    AddContainer();
                }
            }

            _sequenceSO.ApplyModifiedProperties();

//			if( setViewRange )
//			{
//				sequenceEditor.SetViewRange( viewRange );
//			}

            GUI.enabled = true;
        }
        public void OnGUI()
        {
            FSequence sequence = _sequenceWindow.GetSequenceEditor().Sequence;

            if ((_selectedSequenceIndex < 0 && sequence != null) || (_selectedSequenceIndex >= 0 && _sequences[_selectedSequenceIndex] != sequence))
            {
                for (int i = 0; i != _sequences.Length; ++i)
                {
                    if (_sequences[i] == sequence)
                    {
                        _selectedSequenceIndex = i;
                        break;
                    }
                }
            }
            if (FGUI.Button(_loadRect, _loadLabel))
            {
                LoadSequence();
            }
            EditorGUI.BeginChangeCheck();
            EditorGUI.PrefixLabel(_sequenceLabelRect, _sequenceLabel);
            int newSequenceIndex = EditorGUI.Popup(_sequencePopupRect, _selectedSequenceIndex, _sequenceNames);

            if (EditorGUI.EndChangeCheck())
            {
                if (newSequenceIndex == _sequenceNames.Length - 1)
                {
                    FSequence newSequence = FSequenceEditorWindow.CreateSequence();
                    Selection.activeTransform = newSequence.transform;
                    _sequenceWindow.GetSequenceEditor().OpenSequence(newSequence);
                }
                else
                {
                    _selectedSequenceIndex = newSequenceIndex;
                    _sequenceWindow.GetSequenceEditor().OpenSequence(_sequences[_selectedSequenceIndex]);
                    _sequenceWindow.RemoveNotification();
                }
                EditorGUIUtility.keyboardControl = 0; // deselect it
                EditorGUIUtility.ExitGUI();
            }

            if (sequence == null)
            {
                return;
            }

            if (_sequenceSO == null || _sequenceSO.targetObject != sequence)
            {
                _sequenceSO     = new SerializedObject(sequence);
                _sequenceLength = _sequenceSO.FindProperty("_length");
            }
            _sequenceSO.Update();

            EditorGUI.PrefixLabel(_lengthLabelRect, _lengthLabel);
            _sequenceLength.intValue = Mathf.Clamp(EditorGUI.IntField(_lengthFieldRect, _sequenceLength.intValue, _numberFieldStyle), 1, int.MaxValue);

            GUIStyle s = new GUIStyle(EditorStyles.miniButton);

            s.padding = new RectOffset(1, 1, 1, 1);

            if (FGUI.Button(_addContainerRect, _addContainerLabel))
            {
                AddContainer();
            }

            if (FGUI.Button(_openInspectorRect, _openInspectorLabel))
            {
                FInspectorWindow.Open();
            }
            if (FGUI.Button(_saveRect, _saveLabel))
            {
                Save(sequence);
            }
            if (FGUI.Button(_saveAllRect, _saveAllLabel))
            {
                SaveAll();
            }

            _sequenceSO.ApplyModifiedProperties();

            GUI.enabled = true;
        }