コード例 #1
0
        private static void FrameClips(TimelineWindow.TimelineState state)
        {
            int   num  = 0;
            float num2 = 3.40282347E+38f;
            float num3 = -3.40282347E+38f;

            foreach (TrackAsset current in state.timeline.tracks)
            {
                num += current.clips.Length;
                if (num > 1)
                {
                    return;
                }
                TimelineClip[] clips = current.clips;
                for (int i = 0; i < clips.Length; i++)
                {
                    TimelineClip timelineClip = clips[i];
                    num2 = Mathf.Min(num2, (float)timelineClip.start);
                    num3 = Mathf.Max(num3, (float)timelineClip.start + (float)timelineClip.duration);
                }
            }
            if (num == 1)
            {
                float num4 = num3 - num2;
                if (num4 > 0f)
                {
                    state.SetTimeAreaShownRange(Mathf.Max(0f, num2 - num4), num3 + num4);
                }
                else
                {
                    state.SetTimeAreaShownRange(0f, 100f);
                }
            }
        }
コード例 #2
0
        public override bool Execute(TimelineWindow.TimelineState state)
        {
            bool result;

            if (state.IsEditingASubItem())
            {
                result = false;
            }
            else
            {
                TimelineWindow window = state.GetWindow();
                if (window == null || window.treeView == null)
                {
                    result = false;
                }
                else
                {
                    TrackAsset[] visibleTracks = window.treeView.visibleTracks;
                    if (visibleTracks.Length == 0)
                    {
                        result = false;
                    }
                    else
                    {
                        float        num   = 3.40282347E+38f;
                        float        num2  = -3.40282347E+38f;
                        TrackAsset[] array = visibleTracks;
                        for (int i = 0; i < array.Length; i++)
                        {
                            TrackAsset trackAsset = array[i];
                            double     num3;
                            double     num4;
                            trackAsset.GetSequenceTime(out num3, out num4);
                            num  = Mathf.Min(num, (float)num3);
                            num2 = Mathf.Max(num2, (float)(num3 + num4));
                        }
                        float num5 = num2 - Math.Max(0f, num);
                        if (num5 > 0f)
                        {
                            state.SetTimeAreaShownRange(Mathf.Max(-10f, num - num5 * 0.1f), num2 + num5 * 0.1f);
                        }
                        else
                        {
                            state.SetTimeAreaShownRange(0f, 100f);
                        }
                        state.Evaluate();
                        result = true;
                    }
                }
            }
            return(result);
        }
コード例 #3
0
        private static void Frame(TimelineWindow.TimelineState state, float start, float duration, float marginFactor)
        {
            float num = duration * marginFactor;

            state.SetTimeAreaShownRange(Mathf.Max(start - num, -10f), start + duration + num);
            state.Evaluate();
        }
コード例 #4
0
        public override bool Execute(TimelineWindow.TimelineState state)
        {
            bool result;

            if (state.IsEditingASubItem())
            {
                result = false;
            }
            else if (SelectionManager.Count() == 0)
            {
                result = false;
            }
            else
            {
                float num  = 3.40282347E+38f;
                float num2 = -3.40282347E+38f;
                IEnumerable <TimelineClipGUI> enumerable = SelectionManager.SelectedClipGUI();
                if (!enumerable.Any <TimelineClipGUI>())
                {
                    result = false;
                }
                else
                {
                    foreach (TimelineClipGUI current in enumerable)
                    {
                        num  = Mathf.Min(num, (float)current.clip.start);
                        num2 = Mathf.Max(num2, (float)current.clip.start + (float)current.clip.duration);
                        if (current.clipCurveEditor != null)
                        {
                            current.clipCurveEditor.FrameClip();
                        }
                    }
                    float num3 = num2 - num;
                    if (Mathf.Abs(num3) < 1.401298E-45f)
                    {
                        num3 = 1f;
                    }
                    state.SetTimeAreaShownRange(Mathf.Max(num - num3 * 0.2f, -10f), num2 + num3 * 0.2f);
                    state.Evaluate();
                    result = true;
                }
            }
            return(result);
        }