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(); }
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; }
public override void OnInspectorGUI() { base.OnInspectorGUI(); Rect r = GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, EditorGUIUtility.singleLineHeight); r.width -= EditorGUIUtility.labelWidth; EditorGUI.PrefixLabel(r, new GUIContent("Frame Rate")); r.width += EditorGUIUtility.labelWidth; EditorGUI.BeginChangeCheck(); r.xMin += EditorGUIUtility.labelWidth; int frameRate = FGUI.FrameRatePopup(r, _sequence.FrameRate); if (EditorGUI.EndChangeCheck()) { if (frameRate == -1) { FChangeFrameRateWindow.Show(new Vector2(r.xMin - EditorGUIUtility.labelWidth, r.yMax), _sequence, FSequenceInspector.Rescale); EditorGUIUtility.ExitGUI(); } else { Rescale(_sequence, frameRate, true); } } EditorGUILayout.Space(); if (GUILayout.Button("Open In Flux Editor")) { FSequenceEditorWindow.Open(_sequence); } EditorGUILayout.Space(); if (GUILayout.Button(_advancedInspector ? "Normal Inspector" : "Advanced Inspector")) { _advancedInspector = !_advancedInspector; } if (_advancedInspector) { EditorGUILayout.PropertyField(_timelineContainer); EditorGUI.BeginChangeCheck(); bool showTimelines = EditorGUILayout.Toggle("Show Timelines", (_timelineContainer.objectReferenceValue.hideFlags & HideFlags.HideInHierarchy) == 0); if (EditorGUI.EndChangeCheck()) { if (showTimelines) { _timelineContainer.objectReferenceValue.hideFlags &= ~HideFlags.HideInHierarchy; } else { _timelineContainer.objectReferenceValue.hideFlags |= HideFlags.HideInHierarchy; } } } // if( GUILayout.Button("Play") ) // _sequence.Play(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); Rect r = GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, EditorGUIUtility.singleLineHeight); r.width -= EditorGUIUtility.labelWidth; EditorGUI.PrefixLabel(r, new GUIContent("Frame Rate")); r.width += EditorGUIUtility.labelWidth; EditorGUI.BeginChangeCheck(); r.xMin += EditorGUIUtility.labelWidth; int frameRate = FGUI.FrameRatePopup(r, _sequence.FrameRate); if (EditorGUI.EndChangeCheck()) { if (frameRate == -1) { FChangeFrameRateWindow.Show(new Vector2(r.xMin - EditorGUIUtility.labelWidth, r.yMax), _sequence, FSequenceInspector.Rescale); EditorGUIUtility.ExitGUI(); } else { Rescale(_sequence, frameRate, true); } } serializedObject.Update(); EditorGUILayout.PropertyField(_onFinishedCallback); EditorGUILayout.Space(); if (GUILayout.Button("Open In Flux Editor")) { FSequenceEditorWindow.Open(_sequence); } EditorGUILayout.Space(); if (GUILayout.Button(_advancedInspector ? "Normal Inspector" : "Advanced Inspector")) { _advancedInspector = !_advancedInspector; } if (_advancedInspector) { // serializedObject.Update(); EditorGUILayout.PropertyField(_content); // serializedObject.ApplyModifiedProperties(); bool showContent = (_sequence.Content.hideFlags & HideFlags.HideInHierarchy) == 0; EditorGUI.BeginChangeCheck(); showContent = EditorGUILayout.Toggle("Show Content", showContent); // bool showTimelines = EditorGUILayout.Toggle( "Show Timelines", (_timelineContainer.objectReferenceValue.hideFlags & HideFlags.HideInHierarchy) == 0 ); if (EditorGUI.EndChangeCheck()) { if (showContent) { // _timelineContainer.objectReferenceValue.hideFlags &= ~HideFlags.HideInHierarchy; _sequence.Content.transform.hideFlags &= ~HideFlags.HideInHierarchy; // for( int i = 0; i != _sequence.Containers.Count; ++i ) // _sequence.Containers[i].transform.hideFlags &= ~HideFlags.HideInHierarchy; } else { _sequence.Content.transform.hideFlags |= HideFlags.HideInHierarchy; // _timelineContainer.objectReferenceValue.hideFlags |= HideFlags.HideInHierarchy; // for( int i = 0; i != _sequence.Containers.Count; ++i ) // _sequence.Containers[i].transform.hideFlags |= HideFlags.HideInHierarchy; } } } serializedObject.ApplyModifiedProperties(); // serializedObject.ApplyModifiedProperties(); // if( GUILayout.Button("Play") ) // _sequence.Play(); }
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; }