public override void OnInspectorGUI() { AudioClip currentClip = _audioEvt.AudioClip; base.OnInspectorGUI(); if (currentClip != _audioEvt.AudioClip && _audioEvt.AudioClip != null && !_audioEvt.Loop) { if (_audioEvt.LengthTime > _audioEvt.AudioClip.length) { Undo.RecordObject(_audioEvt, null); _audioEvt.Length = Mathf.RoundToInt(_audioEvt.AudioClip.length * _audioEvt.Sequence.FrameRate); FSequenceEditorWindow.RefreshIfOpen(); } } serializedObject.Update(); EditorGUILayout.PropertyField(_audioClip, _audioClipUI); EditorGUILayout.PropertyField(_volume, _volumeUI); EditorGUILayout.PropertyField(_loop, _loopUI); EditorGUILayout.PropertyField(_speedDeterminesPitch, _speedDeterminesPitchUI); _startOffset.intValue = Mathf.Clamp(_startOffset.intValue, 0, _audioEvt.GetMaxStartOffset()); EditorGUI.BeginChangeCheck(); EditorGUILayout.IntSlider(_startOffset, 0, _audioEvt.GetMaxStartOffset(), _startOffsetUI); if (EditorGUI.EndChangeCheck()) { if (FSequenceEditorWindow.instance != null) { FSequenceEditorWindow.instance.Repaint(); } } serializedObject.ApplyModifiedProperties(); }
public override void Init(FObject obj, FEditor owner) { base.Init(obj, owner); FSequenceTrack sequenceTrack = (FSequenceTrack)Obj; if (sequenceTrack.OwnerSequence == null) { FSequence newSequence = FSequenceEditorWindow.CreateSequence(); newSequence.transform.parent = sequenceTrack.transform; sequenceTrack.OwnerSequence = newSequence; foreach (FPlaySequenceEvent evt in sequenceTrack.Events) { evt.Init(); } } if (_sequenceEditor == null) { _sequenceEditor = FSequenceEditor.CreateInstance <FSequenceEditor>(); _sequenceEditor.Init((Editor)null /*SequenceEditor*/); _sequenceEditor.OpenSequence(sequenceTrack.OwnerSequence); // if( Track.PreviewDirtiesScene && !Track.HasCache ) // { // _sequenceEditor.TurnOnAllPreviews( false ); // } } }
public FSequenceWindowToolbar(FSequenceEditorWindow window) { _window = window; _viewRangeLabel = new GUIContent("View Range"); _viewRangeDash = new GUIContent(" - "); }
public FSequenceWindowHeader(FSequenceEditorWindow sequenceWindow) { _sequenceWindow = sequenceWindow; RebuildSequenceList(); EditorApplication.hierarchyWindowChanged += OnHierarchyChanged; }
public static void Open() { FSequenceEditorWindow window = GetWindow <FSequenceEditorWindow>(); window.Show(); window.titleContent = new GUIContent(FSettings.WindownName); window.Update(); }
public static void Open() { FSequenceEditorWindow window = GetWindow <FSequenceEditorWindow>(); window.Show(); window.titleContent = new GUIContent(PRODUCT_NAME); window.Update(); }
public FSequenceWindowHeader(FSequenceEditorWindow sequenceWindow) { _sequenceWindow = sequenceWindow; RebuildSequenceList(); EditorApplication.hierarchyWindowChanged += OnHierarchyChanged; _addContainerLabel.image = FUtility.GetFluxTexture("AddFolder.png"); }
public static void Open() { FSequenceEditorWindow window = GetWindow <FSequenceEditorWindow>(); window.Show(); window.title = PRODUCT_NAME; // window.RebuildRects( true ); window.Update(); }
public static void Open() { FSequenceEditorWindow window = GetWindow <FSequenceEditorWindow>(); window.Show(); #if UNITY_5_0 window.title = PRODUCT_NAME; #else window.titleContent = new GUIContent(PRODUCT_NAME); #endif // window.RebuildRects( true ); window.Update(); }
void OnEnable() { instance = this; wantsMouseMove = true; minSize = new Vector2(450, 300); _windowHeader = new FSequenceWindowHeader(this); _toolbar = new FSequenceWindowToolbar(this); _windowRect = new Rect(); FUtility.LoadPreferences(); }
public FSequenceWindowToolbar(FSequenceEditorWindow window) { _window = window; _firstFrame = new GUIContent(FUtility.GetFluxTexture("FirstFrame.png"), "First Frame"); _previousFrame = new GUIContent(FUtility.GetFluxTexture("PreviousFrame.png"), "Previous Frame"); _nextFrame = new GUIContent(FUtility.GetFluxTexture("NextFrame.png"), "Next Frame"); _lastFrame = new GUIContent(FUtility.GetFluxTexture("LastFrame.png"), "Last Frame"); _playForward = new GUIContent(FUtility.GetFluxTexture("Play.png"), "Play"); _pause = new GUIContent(FUtility.GetFluxTexture("Pause.png"), "Pause"); _stop = new GUIContent(FUtility.GetFluxTexture("Stop.png"), "Stop"); _viewRangeLabel = new GUIContent("View Range"); _viewRangeDash = new GUIContent(" - "); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); serializedObject.Update(); 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(_content); bool showContent = (_sequence.Content.hideFlags & HideFlags.HideInHierarchy) == 0; EditorGUI.BeginChangeCheck(); showContent = EditorGUILayout.Toggle("Show Content", showContent); if (EditorGUI.EndChangeCheck()) { if (showContent) { _sequence.Content.transform.hideFlags &= ~HideFlags.HideInHierarchy; } else { _sequence.Content.transform.hideFlags |= HideFlags.HideInHierarchy; } } } serializedObject.ApplyModifiedProperties(); }
void OnEnable() { instance = this; wantsMouseMove = true; minSize = new Vector2(450, 300); _windowHeader = new FSequenceWindowHeader(this); _toolbar = new FSequenceWindowToolbar(this); _windowRect = new Rect(); FUtility.LoadPreferences(); EditorApplication.playmodeStateChanged += OnPlayModeChanged; EditorApplication.hierarchyWindowChanged += Refresh; Undo.undoRedoPerformed += OnUndo; Undo.postprocessModifications += PostProcessModifications; }
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(); }
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 (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); } } 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; } } } 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; }