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 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(); }