public override void OnInspectorGUI()
        {
            base.get_serializedObject().Update();
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(this.m_FrameRateProperty, TimelineAssetInspector.Styles.FrameRate, new GUILayoutOption[]
            {
                GUILayout.MinWidth(140f)
            });
            double num = Math.Max(this.m_FrameRateProperty.get_doubleValue(), TimeUtility.kFrameRateEpsilon);

            this.m_FrameRateProperty.set_doubleValue(num);
            double frameRate = num;

            EditorGUILayout.PropertyField(this.m_DurationModeProperty, TimelineAssetInspector.Styles.DurationMode, new GUILayoutOption[]
            {
                GUILayout.MinWidth(140f)
            });
            TimelineAsset.DurationMode enumValueIndex = (TimelineAsset.DurationMode) this.m_DurationModeProperty.get_enumValueIndex();
            if (enumValueIndex == TimelineAsset.DurationMode.FixedLength)
            {
                TimelineInspectorUtility.TimeField(this.m_FixedDurationProperty, TimelineAssetInspector.Styles.Duration, false, frameRate, 4.94065645841247E-324, TimelineClip.kMaxTimeValue * 2.0);
            }
            else
            {
                bool showMixed = base.get_targets().Length > 1;
                TimelineInspectorUtility.TimeField(TimelineAssetInspector.Styles.Duration, ((TimelineAsset)base.get_target()).get_duration(), true, showMixed, frameRate, -1.7976931348623157E+308, 1.7976931348623157E+308);
            }
            bool flag = EditorGUI.EndChangeCheck();

            base.get_serializedObject().ApplyModifiedProperties();
            if (flag)
            {
                TimelineWindow.RepaintIfEditingTimelineAsset((TimelineAsset)base.get_target());
            }
        }
Exemple #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.PropertyField(m_FrameRateProperty, Styles.FrameRate, GUILayout.MinWidth(140));
            var frameRate = m_FrameRateProperty.doubleValue;

            EditorGUILayout.PropertyField(m_DurationModeProperty, Styles.DurationMode, GUILayout.MinWidth(140));

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

            bool changed = EditorGUI.EndChangeCheck();

            serializedObject.ApplyModifiedProperties();

            if (changed)
            {
                TimelineWindow.RepaintIfEditingTimelineAsset((TimelineAsset)target);
            }
        }
        private void DrawDurationProperty()
        {
            double minValue = 0.033333333333333333;

            if (this.currentFrameRate > 1.401298E-45f)
            {
                minValue = 1.0 / (double)this.currentFrameRate;
            }
            TimelineInspectorUtility.TimeField(this.m_DurationProperty, ClipInspector.Styles.DurationName, false, (double)this.currentFrameRate, minValue, TimelineClip.kMaxTimeValue);
        }
        private void DrawBlendingProperties()
        {
            bool   hasBlendIn = this.m_SelectionInfo.hasBlendIn;
            double num        = this.m_SelectionCache.Min((ClipInspector.EditorClipSelection e) => e.clip.duration);
            double maxValue   = (!hasBlendIn) ? (num * 0.49) : TimelineClip.kMaxTimeValue;

            TimelineInspectorUtility.TimeField((!hasBlendIn) ? this.m_EaseInDurationProperty : this.m_BlendInDurationProperty, ClipInspector.Styles.EaseInDurationName, hasBlendIn, (double)this.currentFrameRate, 0.0, maxValue);
            bool hasBlendOut = this.m_SelectionInfo.hasBlendOut;

            maxValue = ((!hasBlendOut) ? (num * 0.49) : TimelineClip.kMaxTimeValue);
            TimelineInspectorUtility.TimeField((!hasBlendOut) ? this.m_EaseOutDurationProperty : this.m_BlendOutDurationProperty, ClipInspector.Styles.EaseOutDurationName, hasBlendOut, (double)this.currentFrameRate, 0.0, maxValue);
        }
        void DrawBlendingProperties()
        {
            const double mixMinimum = 0.0;
            var          inputEvent = InputEvent.None;
            double       blendMax;
            GUIContent   label;

            var useBlendIn = m_SelectionInfo.hasBlendIn;
            SerializedProperty currentMixInProperty;

            if (!useBlendIn)
            {
                currentMixInProperty = m_EaseInDurationProperty;
                var blendOutStart = m_SelectionInfo.duration - m_BlendOutDurationProperty.doubleValue;
                blendMax = Math.Min(Math.Max(mixMinimum, m_SelectionInfo.maxMixIn), blendOutStart);
                label    = Styles.EaseInDurationName;
            }
            else
            {
                currentMixInProperty = m_BlendInDurationProperty;
                blendMax             = TimelineClip.kMaxTimeValue;
                label = Styles.BlendInDurationName;
            }
            if (blendMax > TimeUtility.kTimeEpsilon)
            {
                TimelineInspectorUtility.TimeField(currentMixInProperty, label, useBlendIn, currentFrameRate, mixMinimum,
                                                   blendMax, ref inputEvent);
            }


            var useBlendOut = m_SelectionInfo.hasBlendOut;
            SerializedProperty currentMixOutProperty;

            if (!useBlendOut)
            {
                currentMixOutProperty = m_EaseOutDurationProperty;
                var blendInEnd = m_SelectionInfo.duration - m_BlendInDurationProperty.doubleValue;
                blendMax = Math.Min(Math.Max(mixMinimum, m_SelectionInfo.maxMixOut), blendInEnd);
                label    = Styles.EaseOutDurationName;
            }
            else
            {
                currentMixOutProperty = m_BlendOutDurationProperty;
                blendMax = TimelineClip.kMaxTimeValue;
                label    = Styles.BlendOutDurationName;
            }
            if (blendMax > TimeUtility.kTimeEpsilon)
            {
                TimelineInspectorUtility.TimeField(currentMixOutProperty, label, useBlendOut, currentFrameRate,
                                                   mixMinimum, blendMax, ref inputEvent);
            }
        }
        void DrawGroupSelectionProperties()
        {
            var inputEvent   = InputEvent.None;
            var newStartTime = TimelineInspectorUtility.TimeField(Styles.MultipleClipStartName, m_SelectionInfo.multipleClipStart, false, false, currentFrameRate, 0, TimelineClip.kMaxTimeValue, ref inputEvent);

            EditMode.inputHandler.ProcessMove(inputEvent, newStartTime);

            inputEvent = InputEvent.None;
            var newEndTime    = TimelineInspectorUtility.TimeField(Styles.MultipleClipEndName, m_SelectionInfo.multipleClipEnd, false, false, currentFrameRate, 0, TimelineClip.kMaxTimeValue, ref inputEvent);
            var newStartValue = newStartTime + (newEndTime - m_SelectionInfo.multipleClipEnd);

            EditMode.inputHandler.ProcessMove(inputEvent, newStartValue);
        }
        private void DrawEndTimeProperty()
        {
            bool showMixed = this.m_StartProperty.get_hasMultipleDifferentValues() || this.m_DurationProperty.get_hasMultipleDifferentValues();

            EditorGUI.BeginChangeCheck();
            double time = this.m_StartProperty.get_doubleValue() + this.m_DurationProperty.get_doubleValue();
            double num  = TimelineInspectorUtility.TimeField(ClipInspector.Styles.EndName, time, false, showMixed, (double)this.m_TimelineAsset.editorSettings.fps, -TimelineClip.kMaxTimeValue, TimelineClip.kMaxTimeValue * 2.0);

            if (EditorGUI.EndChangeCheck())
            {
                this.m_DurationProperty.set_doubleValue(Math.Max(1E-06, num - this.m_StartProperty.get_doubleValue()));
            }
        }
        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);
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        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);
        }
        void DrawClipInProperty()
        {
            var action = InputEvent.None;

            TimelineInspectorUtility.TimeField(m_ClipInProperty, Styles.ClipInName, false, currentFrameRate, 0, TimelineClip.kMaxTimeValue, ref action);
        }
Exemple #14
0
        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);
        }
Exemple #15
0
        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);
 }