void DrawExtrapolationOptions()
        {
            EditorGUI.BeginChangeCheck();

            // PreExtrapolation
            var  preExtrapolationTime = m_PreExtrapolationTimeProperty.doubleValue;
            bool hasPreExtrap         = preExtrapolationTime > 0.0;

            if (hasPreExtrap)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(m_PreExtrapolationModeProperty, Styles.PreExtrapolateLabel);
                using (new GUIMixedValueScope(m_PreExtrapolationTimeProperty.hasMultipleDifferentValues))
                    EditorGUILayout.DoubleField(preExtrapolationTime, EditorStyles.label);
                EditorGUILayout.EndHorizontal();
            }

            // PostExtrapolation
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(m_PostExtrapolationModeProperty, Styles.PostExtrapolateLabel);
                using (new GUIMixedValueScope(m_PostExtrapolationTimeProperty.hasMultipleDifferentValues))
                    EditorGUILayout.DoubleField(m_PostExtrapolationTimeProperty.doubleValue, EditorStyles.label);
                EditorGUILayout.EndHorizontal();
            }

            if (EditorGUI.EndChangeCheck())
            {
                // if these options change the interval tree may need to be rebuilt.
                if (TimelineWindow.IsEditingTimelineAsset(m_TimelineAsset) && TimelineWindow.instance.state != null)
                {
                    TimelineWindow.instance.state.Refresh();
                }
            }
        }
        private void DrawExtrapolationOptions()
        {
            EditorGUI.BeginChangeCheck();
            double doubleValue = this.m_PreExtrapolationTimeProperty.get_doubleValue();
            bool   flag        = doubleValue > 0.0;

            if (flag)
            {
                EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_PreExtrapolationModeProperty, ClipInspector.Styles.PreExtrapolateLabel, new GUILayoutOption[0]);
                EditorGUI.set_showMixedValue(this.m_PreExtrapolationTimeProperty.get_hasMultipleDifferentValues());
                EditorGUILayout.DoubleField(doubleValue, EditorStyles.get_label(), new GUILayoutOption[0]);
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_PostExtrapolationModeProperty, ClipInspector.Styles.PostExtrapolateLabel, new GUILayoutOption[0]);
            EditorGUI.set_showMixedValue(this.m_PostExtrapolationTimeProperty.get_hasMultipleDifferentValues());
            EditorGUILayout.DoubleField(this.m_PostExtrapolationTimeProperty.get_doubleValue(), EditorStyles.get_label(), new GUILayoutOption[0]);
            EditorGUILayout.EndHorizontal();
            if (EditorGUI.EndChangeCheck())
            {
                if (TimelineWindow.IsEditingTimelineAsset(this.m_TimelineAsset) && TimelineWindow.instance.state != null)
                {
                    TimelineWindow.instance.state.Refresh();
                }
            }
        }
        void ShowPlayableAssetInspector()
        {
            if (!m_SelectionInfo.selectedAssetTypesAreHomogeneous)
            {
                return;
            }

            if (m_SelectedPlayableAssetsInspector != null)
            {
                if (Event.current.type == EventType.Repaint || Event.current.type == EventType.Layout)
                {
                    foreach (var selectedItem in m_SelectionCache)
                    {
                        CurvesOwnerInspectorHelper.PreparePlayableAsset(selectedItem);
                    }
                }

                EditorGUI.BeginChangeCheck();
                using (new EditorGUI.DisabledScope(IsLocked()))
                {
                    m_SelectedPlayableAssetsInspector.OnInspectorGUI();
                }

                if (EditorGUI.EndChangeCheck())
                {
                    MarkClipsDirty();
                    if (TimelineWindow.IsEditingTimelineAsset(m_TimelineAsset) && TimelineWindow.instance.state != null)
                    {
                        var inspectorChangeHandler = m_SelectedPlayableAssetsInspector as IInspectorChangeHandler;
                        if (inspectorChangeHandler != null)
                        {
                            inspectorChangeHandler.OnPlayableAssetChangedInInspector();
                        }
                        else
                        {
                            TimelineEditor.Refresh(RefreshReason.ContentsModified);
                        }
                    }
                }
            }
        }
 private void ShowPlayableAssetInspector()
 {
     if (this.m_SelectionInfo.selectedAssetTypesAreHomogeneous)
     {
         if (this.m_SelectedPlayableAssetsInspector != null)
         {
             foreach (ClipInspector.EditorClipSelection current in this.m_SelectionCache)
             {
                 ClipInspector.PreparePlayableAsset(current);
             }
             EditorGUI.BeginChangeCheck();
             this.m_SelectedPlayableAssetsInspector.OnInspectorGUI();
             if (EditorGUI.EndChangeCheck())
             {
                 if (TimelineWindow.IsEditingTimelineAsset(this.m_TimelineAsset) && TimelineWindow.instance.state != null)
                 {
                     TimelineWindow.instance.state.rebuildGraph = true;
                     TimelineWindow.instance.Repaint();
                 }
             }
         }
     }
 }
        void ShowPlayableAssetInspector()
        {
            if (!m_SelectionInfo.selectedAssetTypesAreHomogeneous)
            {
                return;
            }

            if (m_SelectedPlayableAssetsInspector != null)
            {
                foreach (var selectedItem in m_SelectionCache)
                {
                    CurvesOwnerInspectorHelper.PreparePlayableAsset(selectedItem);
                }

                EditorGUI.BeginChangeCheck();
                using (new EditorGUI.DisabledScope(IsLocked()))
                {
                    m_SelectedPlayableAssetsInspector.OnInspectorGUI();
                }
                if (EditorGUI.EndChangeCheck())
                {
                    MarkClipsDirty();
                    if (TimelineWindow.IsEditingTimelineAsset(m_TimelineAsset) && TimelineWindow.instance.state != null)
                    {
                        var basicInspector = m_SelectedPlayableAssetsInspector as BasicAssetInspector;
                        if (basicInspector != null)
                        {
                            basicInspector.ApplyChanges();
                        }
                        else
                        {
                            TimelineEditor.Refresh(RefreshReason.ContentsModified);
                        }
                    }
                }
            }
        }
        void DrawClipProperties()
        {
            var dirtyEditorClipSelection = m_SelectionCache.Where(s => s.editorClip.GetHashCode() != s.editorClip.lastHash);

            UnselectCurves();

            EditorGUI.BeginChangeCheck();

            //Group Selection
            if (hasMultipleSelection)
            {
                GUILayout.Label(Styles.GroupTimingTitle);
                EditorGUI.indentLevel++;
                DrawGroupSelectionProperties();
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }

            //Draw clip timing
            GUILayout.Label(Styles.ClipTimingTitle);

            if (hasMultipleSelection && selectionHasIncompatibleCapabilities)
            {
                GUILayout.Label(Styles.MultipleClipsSelectedIncompatibleCapabilitiesWarning, EditorStyles.helpBox);
            }

            EditorGUI.indentLevel++;

            if (!m_SelectionInfo.containsAtLeastTwoClipsOnTheSameTrack)
            {
                DrawStartTimeField();
                DrawEndTimeField();
            }

            if (!hasMultipleSelection)
            {
                DrawDurationProperty();
            }

            if (m_SelectionInfo.supportsBlending)
            {
                EditorGUILayout.Space();
                DrawBlendingProperties();
            }

            if (m_SelectionInfo.supportsClipIn)
            {
                EditorGUILayout.Space();
                DrawClipInProperty();
            }

            if (!hasMultipleSelection && m_SelectionInfo.supportsSpeedMultiplier)
            {
                EditorGUILayout.Space();
                DrawTimeScale();
            }

            EditorGUI.indentLevel--;

            bool hasDirtyEditorClips = false;

            foreach (var editorClipSelection in dirtyEditorClipSelection)
            {
                EditorUtility.SetDirty(editorClipSelection.editorClip);
                hasDirtyEditorClips = true;
            }

            //Re-evaluate the graph in case of a change in properties
            bool propertiesHaveChanged = false;

            if (EditorGUI.EndChangeCheck() || hasDirtyEditorClips)
            {
                if (TimelineWindow.IsEditingTimelineAsset(m_TimelineAsset) && TimelineWindow.instance.state != null)
                {
                    TimelineWindow.instance.state.Evaluate();
                    TimelineWindow.instance.Repaint();
                }
                propertiesHaveChanged = true;
            }

            //Draw Animation Extrapolation
            if (m_SelectionInfo.supportsExtrapolation)
            {
                EditorGUILayout.Space();
                GUILayout.Label(Styles.AnimationExtrapolationTitle);
                EditorGUI.indentLevel++;
                DrawExtrapolationOptions();
                EditorGUI.indentLevel--;
            }

            //Blend curves
            if (m_SelectionInfo.supportsBlending)
            {
                EditorGUILayout.Space();
                GUILayout.Label(Styles.BlendCurvesTitle);
                EditorGUI.indentLevel++;
                DrawBlendOptions();
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            if (CanShowPlayableAssetInspector())
            {
                DrawClipAssetGui();
            }

            if (propertiesHaveChanged)
            {
                foreach (var item in m_SelectionCache)
                {
                    item.editorClip.lastHash = item.editorClip.GetHashCode();
                }
                m_SelectionInfo.Update();
            }
        }
        private void DrawClipProperties()
        {
            IEnumerable <ClipInspector.EditorClipSelection> enumerable = from s in this.m_SelectionCache
                                                                         where s.editorClip.GetHashCode() != s.editorClip.lastHash
                                                                         select s;

            this.UnselectCurves();
            EditorGUI.BeginChangeCheck();
            if (this.hasMultipleSelection)
            {
                GUILayout.Label(ClipInspector.Styles.GroupTimingTitle, new GUILayoutOption[0]);
                EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() + 1);
                this.DrawGroupSelectionProperties();
                EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() - 1);
                EditorGUILayout.Space();
            }
            GUILayout.Label(ClipInspector.Styles.ClipTimingTitle, new GUILayoutOption[0]);
            if (this.hasMultipleSelection && this.selectionHasIncompatibleCapabilities)
            {
                GUILayout.Label(ClipInspector.Styles.MultipleClipsSelectedIncompatibleCapabilitiesWarning, EditorStyles.get_helpBox(), new GUILayoutOption[0]);
            }
            EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() + 1);
            if (!this.m_SelectionInfo.selectionContainsAtLeastTwoClipsOnTheSameTrack)
            {
                this.DrawStartTimeProperty();
                this.DrawEndTimeProperty();
            }
            if (!this.hasMultipleSelection)
            {
                this.DrawDurationProperty();
            }
            if (this.m_SelectionInfo.supportsBlending)
            {
                EditorGUILayout.Space();
                this.DrawBlendingProperties();
            }
            if (this.m_SelectionInfo.supportsClipIn)
            {
                EditorGUILayout.Space();
                this.DrawClipInProperty();
            }
            if (!this.hasMultipleSelection && this.m_SelectionInfo.supportsSpeedMultiplier)
            {
                EditorGUILayout.Space();
                this.DrawTimeScaleProperty();
            }
            EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() - 1);
            bool flag = false;

            foreach (ClipInspector.EditorClipSelection current in enumerable)
            {
                EditorUtility.SetDirty(current.editorClip);
                flag = true;
            }
            bool flag2 = false;

            if (EditorGUI.EndChangeCheck() || flag)
            {
                if (TimelineWindow.IsEditingTimelineAsset(this.m_TimelineAsset) && TimelineWindow.instance.state != null)
                {
                    TimelineWindow.instance.state.Evaluate();
                    TimelineWindow.instance.Repaint();
                }
                flag2 = true;
            }
            if (this.m_SelectionInfo.supportsExtrapolation)
            {
                EditorGUILayout.Space();
                GUILayout.Label(ClipInspector.Styles.AnimationExtrapolationTitle, new GUILayoutOption[0]);
                EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() + 1);
                this.DrawExtrapolationOptions();
                EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() - 1);
            }
            if (this.m_SelectionInfo.supportsBlending)
            {
                EditorGUILayout.Space();
                GUILayout.Label(ClipInspector.Styles.BlendCurvesTitle, new GUILayoutOption[0]);
                EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() + 1);
                this.DrawBlendOptions();
                EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() - 1);
            }
            EditorGUILayout.Space();
            if (this.CanShowPlayableAssetInspector())
            {
                this.DrawClipAssetGui();
            }
            if (flag2)
            {
                foreach (ClipInspector.EditorClipSelection current2 in this.m_SelectionCache)
                {
                    current2.editorClip.lastHash = current2.editorClip.GetHashCode();
                }
            }
        }