public static TrackDrawOptions GetTrackOptions_Safe(this TrackEditor editor, TrackAsset track, UnityEngine.Object binding)
 {
     try
     {
         return(editor.GetTrackOptions(track, binding));
     }
     catch (Exception e)
     {
         Debug.LogException(e);
         return(CustomTimelineEditorCache.GetDefaultTrackEditor().GetTrackOptions(track, binding));
     }
 }
Exemple #2
0
        void UpdateDrawData(WindowState state)
        {
            if (Event.current.type == EventType.Layout)
            {
                m_TrackDrawData.m_ShowTrackBindings = false;
                m_TrackDrawData.m_TrackBinding      = null;


                if (state.editSequence.director != null && showSceneReference)
                {
                    m_TrackDrawData.m_ShowTrackBindings = state.GetWindow().currentMode.ShouldShowTrackBindings(state);
                    m_TrackDrawData.m_TrackBinding      = state.editSequence.director.GetGenericBinding(track);
                }

                var lastError  = m_TrackDrawOptions.errorText;
                var lastHeight = m_TrackDrawOptions.minimumHeight;
                try
                {
                    m_TrackDrawOptions = m_TrackEditor.GetTrackOptions(track, m_TrackDrawData.m_TrackBinding);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                    m_TrackDrawOptions = CustomTimelineEditorCache.GetDefaultTrackEditor().GetTrackOptions(track, m_TrackDrawData.m_TrackBinding);
                }

                m_TrackDrawData.m_AllowsRecording = DoesTrackAllowsRecording(track);
                m_TrackDrawData.m_TrackIcon       = m_TrackDrawOptions.icon;
                if (m_TrackDrawData.m_TrackIcon == null)
                {
                    m_TrackDrawData.m_TrackIcon = m_DefaultTrackIcon.image;
                }
                // if the problem state has changed, it may be due to external bindings
                // in that case, we need to tell the graph to rebuild.
                // there is no notification from the engine for some markers that invalidate the graph (addcomponent)
                if (m_TrackDrawData.m_ShowTrackBindings && lastError != null && !lastError.Equals(m_TrackDrawOptions.errorText) && !state.playing)
                {
                    state.rebuildGraph = true;
                }

                // track height has changed. need to update gui
                if (!Mathf.Approximately(lastHeight, m_TrackDrawOptions.minimumHeight))
                {
                    state.Refresh();
                }
            }
        }
Exemple #3
0
        public TimelineTrackGUI(TreeViewController tv, TimelineTreeViewGUI w, int id, int depth, TreeViewItem parent, string displayName, TrackAsset sequenceActor)
            : base(tv, w, id, depth, parent, displayName, sequenceActor, false)
        {
            AnimationTrack animationTrack = sequenceActor as AnimationTrack;

            if (animationTrack != null)
            {
                m_InfiniteTrackDrawer = new InfiniteTrackDrawer(new AnimationTrackKeyDataSource(animationTrack));
            }
            else if (sequenceActor.HasAnyAnimatableParameters() && !sequenceActor.clips.Any())
            {
                m_InfiniteTrackDrawer = new InfiniteTrackDrawer(new TrackPropertyCurvesDataSource(sequenceActor));
            }

            UpdateInfiniteClipEditor(w.TimelineWindow);

            var bindings = track.outputs.ToArray();

            m_TrackDrawData.m_HasBinding = bindings.Length > 0;
            if (m_TrackDrawData.m_HasBinding)
            {
                m_TrackDrawData.m_Binding = bindings[0];
            }
            m_TrackDrawData.m_IsSubTrack      = IsSubTrack();
            m_TrackDrawData.m_AllowsRecording = DoesTrackAllowsRecording(sequenceActor);
            m_DefaultTrackIcon = TrackResourceCache.GetTrackIcon(track);


            m_TrackEditor = CustomTimelineEditorCache.GetTrackEditor(sequenceActor);

            try
            {
                m_TrackDrawOptions = m_TrackEditor.GetTrackOptions(track, null);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                m_TrackDrawOptions = CustomTimelineEditorCache.GetDefaultTrackEditor().GetTrackOptions(track, null);
            }

            m_TrackDrawOptions.errorText = null; // explicitly setting to null for an uninitialized state

            RebuildGUICacheIfNecessary();
        }
Exemple #4
0
        void UpdateDrawData(WindowState state)
        {
            if (Event.current.type == EventType.Layout)
            {
                m_TrackDrawData.m_ShowTrackBindings = false;
                m_TrackDrawData.m_TrackBinding      = null;


                if (state.editSequence.director != null && showSceneReference)
                {
                    m_TrackDrawData.m_ShowTrackBindings = state.GetWindow().currentMode.ShouldShowTrackBindings(state);
                    m_TrackDrawData.m_TrackBinding      = state.editSequence.director.GetGenericBinding(track);
                }

                var lastError  = m_TrackDrawOptions.errorText;
                var lastHeight = m_TrackDrawOptions.minimumHeight;
                try
                {
                    m_TrackDrawOptions = m_TrackEditor.GetTrackOptions(track, m_TrackDrawData.m_TrackBinding);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                    m_TrackDrawOptions = CustomTimelineEditorCache.GetDefaultTrackEditor().GetTrackOptions(track, m_TrackDrawData.m_TrackBinding);
                }

                m_TrackDrawData.m_AllowsRecording = DoesTrackAllowsRecording(track);
                m_TrackDrawData.m_TrackIcon       = m_TrackDrawOptions.icon;
                if (m_TrackDrawData.m_TrackIcon == null)
                {
                    m_TrackDrawData.m_TrackIcon = m_DefaultTrackIcon.image;
                }

                // track height has changed. need to update gui
                if (!Mathf.Approximately(lastHeight, m_TrackDrawOptions.minimumHeight))
                {
                    state.Refresh();
                }
            }
        }