void DrawDurationProperty() { var minDuration = 1.0 / 30.0; if (currentFrameRate > float.Epsilon) { minDuration = 1.0 / currentFrameRate; } var inputEvent = InputEvent.None; var newDuration = TimelineInspectorUtility.DurationFieldUsingTimeReference( Styles.DurationName, m_SelectionInfo.start, m_SelectionInfo.end, false, m_SelectionInfo.hasMultipleDurationValues, currentFrameRate, minDuration, TimelineClip.kMaxTimeValue, ref inputEvent); EditMode.inputHandler.ProcessTrim(inputEvent, m_SelectionInfo.start + newDuration, false); }
void DrawEndTimeField() { var inputEvent = InputEvent.None; var newEndTime = TimelineInspectorUtility.TimeFieldUsingTimeReference(Styles.EndName, m_SelectionInfo.multipleClipEnd, false, m_SelectionInfo.hasMultipleEndValues, currentFrameRate, 0, TimelineClip.kMaxTimeValue, ref inputEvent); if (inputEvent.InputHasBegun() && m_SelectionInfo.hasMultipleEndValues) { var items = ItemsUtils.ToItems(m_SelectionInfo.clips); EditMode.inputHandler.SetValueForEdge(items, AttractedEdge.Right, newEndTime); //if the field has multiple value, set the same end on all selected clips m_SelectionInfo.Update(); //clips could have moved relative to each other, recalculate } var newStartValue = m_SelectionInfo.multipleClipStart + (newEndTime - m_SelectionInfo.multipleClipEnd); EditMode.inputHandler.ProcessMove(inputEvent, newStartValue); }
void DrawTimeScale() { var inputEvent = InputEvent.None; var newEndTime = m_SelectionInfo.end; var oldTimeScale = m_TimeScaleProperty.doubleValue; EditorGUI.BeginChangeCheck(); var newTimeScale = TimelineInspectorUtility.DelayedAndDraggableDoubleField(Styles.TimeScaleName, oldTimeScale, ref inputEvent, k_TimeScaleSensitivity); if (EditorGUI.EndChangeCheck()) { newTimeScale = newTimeScale.Clamp(TimelineClip.kTimeScaleMin, TimelineClip.kTimeScaleMax); newEndTime = m_SelectionInfo.start + (m_SelectionInfo.duration * oldTimeScale / newTimeScale); } EditMode.inputHandler.ProcessTrim(inputEvent, newEndTime, true); }
void DrawBlendingProperties() { var useBlendIn = m_SelectionInfo.hasBlendIn; var maxBlendDuration = m_SelectionInfo.smallestDuration * 0.49; var blendMax = useBlendIn ? TimelineClip.kMaxTimeValue : maxBlendDuration; var inputEvent = InputEvent.None; TimelineInspectorUtility.TimeField(useBlendIn ? m_BlendInDurationProperty : m_EaseInDurationProperty, Styles.EaseInDurationName, useBlendIn, currentFrameRate, 0, blendMax, ref inputEvent); var useBlendOut = m_SelectionInfo.hasBlendOut; blendMax = useBlendOut ? TimelineClip.kMaxTimeValue : maxBlendDuration; TimelineInspectorUtility.TimeField(useBlendOut ? m_BlendOutDurationProperty : m_EaseOutDurationProperty, Styles.EaseOutDurationName, useBlendOut, currentFrameRate, 0, blendMax, ref inputEvent); }
static void TimeFieldWithEditMode(Rect rect, SerializedProperty property, GUIContent label) { double minStartTime; if (property.hasMultipleDifferentValues) { minStartTime = SelectionManager.SelectedItems().Min(i => i.start); } else { minStartTime = property.doubleValue; } var evt = InputEvent.None; var newValue = TimelineInspectorUtility.TimeField( rect, label, minStartTime, false, property.hasMultipleDifferentValues, currentFrameRate, 0.0, float.MaxValue, ref evt); EditMode.inputHandler.ProcessMove(evt, newValue); }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_FrameRateProperty, Styles.FrameRate); #if TIMELINE_FRAMEACCURATE if (EditorGUI.EndChangeCheck()) { ResetFrameLockedPlayback(targets); } #else EditorGUI.EndChangeCheck(); #endif var frameRate = m_FrameRateProperty.doubleValue; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_DurationModeProperty, Styles.DurationMode, GUILayout.MinWidth(k_MinWidth)); var durationMode = (TimelineAsset.DurationMode)m_DurationModeProperty.enumValueIndex; var inputEvent = InputEvent.None; if (durationMode == TimelineAsset.DurationMode.FixedLength) { TimelineInspectorUtility.TimeField(m_FixedDurationProperty, Styles.Duration, false, frameRate, double.Epsilon, TimelineClip.kMaxTimeValue * 2, ref inputEvent); } else { var isMixed = targets.Length > 1; TimelineInspectorUtility.TimeField(Styles.Duration, ((TimelineAsset)target).duration, true, isMixed, frameRate, double.MinValue, double.MaxValue, ref inputEvent); } DrawIgnorePreviewProperty(); var changed = EditorGUI.EndChangeCheck(); serializedObject.ApplyModifiedProperties(); if (changed) { TimelineEditor.Refresh(RefreshReason.WindowNeedsRedraw); } }
private void DrawGroupSelectionProperties() { EditorGUI.BeginChangeCheck(); double num = this.m_SelectionCache.Min((ClipInspector.EditorClipSelection earliestEditorClip) => earliestEditorClip.clip.start); double num2 = TimelineInspectorUtility.TimeField(ClipInspector.Styles.StartName, num, false, false, (double)this.currentFrameRate, 0.0, TimelineClip.kMaxTimeValue); if (EditorGUI.EndChangeCheck()) { double delta = num2 - num; this.ShiftSelectedClips(delta); } EditorGUI.BeginChangeCheck(); double num3 = this.m_SelectionCache.Max((ClipInspector.EditorClipSelection lastEditorClip) => lastEditorClip.clip.end); double minValue = num3 - num; double num4 = TimelineInspectorUtility.TimeField(ClipInspector.Styles.EndName, num3, false, false, (double)this.currentFrameRate, minValue, TimelineClip.kMaxTimeValue); if (EditorGUI.EndChangeCheck()) { double delta2 = num4 - num3; this.ShiftSelectedClips(delta2); } }
void DrawBlendingProperties() { const double mixMinimum = 0.0; var useBlendIn = m_SelectionInfo.hasBlendIn; var useBlendOut = m_SelectionInfo.hasBlendOut; var currentMixInProperty = useBlendIn ? m_BlendInDurationProperty : m_EaseInDurationProperty; var currentMixOutProperty = useBlendOut ? m_BlendOutDurationProperty : m_EaseOutDurationProperty; var maxEaseIn = Math.Max(mixMinimum, m_SelectionInfo.maxMixIn); var maxEaseOut = Math.Max(mixMinimum, m_SelectionInfo.maxMixOut); var inputEvent = InputEvent.None; var blendMax = useBlendIn ? TimelineClip.kMaxTimeValue : maxEaseIn; var label = useBlendIn ? Styles.BlendInDurationName : Styles.EaseInDurationName; TimelineInspectorUtility.TimeField(currentMixInProperty, label, useBlendIn, currentFrameRate, mixMinimum, blendMax, ref inputEvent); blendMax = useBlendOut ? TimelineClip.kMaxTimeValue : maxEaseOut; label = useBlendOut ? Styles.BlendOutDurationName : Styles.EaseOutDurationName; TimelineInspectorUtility.TimeField(currentMixOutProperty, label, useBlendOut, currentFrameRate, mixMinimum, blendMax, ref inputEvent); }
public void OnEnable() { Undo.undoRedoPerformed += OnUndoRedoPerformed; m_ClipCurveEditor = new ClipInspectorCurveEditor(); m_SelectionCache = new List <EditorClipSelection>(); var selectedClips = new List <TimelineClip>(); foreach (var editorClipObject in targets) { var editorClip = editorClipObject as EditorClip; if (editorClip != null) { //all selected clips should have the same TimelineAsset if (!IsTimelineAssetValidForEditorClip(editorClip)) { m_SelectionCache.Clear(); return; } m_SelectionCache.Add(new EditorClipSelection(editorClip)); selectedClips.Add(editorClip.clip); } } InitializeProperties(); m_SelectionInfo = new ClipInspectorSelectionInfo(selectedClips); if (m_SelectionInfo.selectedAssetTypesAreHomogeneous) { var selectedAssets = m_SelectionCache.Select(e => e.clip.asset).ToArray(); m_SelectedPlayableAssetsInspector = TimelineInspectorUtility.GetInspectorForObjects(selectedAssets, m_SelectedPlayableAssetsInspector); } m_MultiselectionHeaderTitle = m_SelectionCache.Count + " " + Styles.MultipleSelectionTitle.text; m_ClipAssetTitle.text = PlayableAssetSectionTitle(); }
void DrawClipInProperty() { var action = InputEvent.None; TimelineInspectorUtility.TimeField(m_ClipInProperty, Styles.ClipInName, false, currentFrameRate, 0, TimelineClip.kMaxTimeValue, ref action); }
public static void TimeField(SerializedProperty property, GUIContent label, bool readOnly, double frameRate, double minValue, double maxValue) { Rect controlRect = EditorGUILayout.GetControlRect(new GUILayoutOption[0]); TimelineInspectorUtility.TimeField(controlRect, property, label, readOnly, frameRate, minValue, maxValue); }
static void TimeField(Rect rect, SerializedProperty property, GUIContent label) { var evt1 = InputEvent.None; TimelineInspectorUtility.TimeField(rect, property, label, false, currentFrameRate, 0, float.MaxValue, ref evt1); }
private void DrawClipInProperty() { TimelineInspectorUtility.TimeField(this.m_ClipInProperty, ClipInspector.Styles.ClipInName, false, (double)this.currentFrameRate, 0.0, TimelineClip.kMaxTimeValue); }