Ejemplo n.º 1
0
        internal static int CalcAnimClipHash(TimelineAsset asset)
        {
            int num = 0;

            foreach (TrackAsset current in asset.tracks)
            {
                num ^= KeyTraverser.CalcAnimClipHash(current);
            }
            return(num);
        }
Ejemplo n.º 2
0
        private void CheckCache(int dirtyStamp)
        {
            int num = KeyTraverser.CalcAnimClipHash(this.m_Asset);

            if (dirtyStamp != this.m_DirtyStamp || num != this.m_LastHash)
            {
                this.RebuildKeyCache();
                this.m_DirtyStamp = dirtyStamp;
                this.m_LastHash   = num;
            }
        }
        public override bool Execute(WindowState state)
        {
            var keyTraverser = new Utilities.KeyTraverser(state.editSequence.asset, 0.01f / state.referenceSequence.frameRate);
            var time         = keyTraverser.GetNextKey((float)state.editSequence.time, state.dirtyStamp);

            if (time != state.editSequence.time)
            {
                state.editSequence.time = time;
            }

            return(true);
        }
Ejemplo n.º 4
0
        public override bool Execute(ActionContext actionContext)
        {
            if (TimelineEditor.inspectedAsset == null)
            {
                return(false);
            }
            var keyTraverser = new Utilities.KeyTraverser(TimelineEditor.inspectedAsset, 0.01f / TimelineEditor.inspectedAsset.editorSettings.fps);
            var time         = keyTraverser.GetNextKey((float)TimelineEditor.inspectedSequenceTime, TimelineWindow.instance.state.dirtyStamp);

            if (time != TimelineEditor.inspectedSequenceTime)
            {
                TimelineEditor.inspectedSequenceTime = time;
            }

            return(true);
        }
Ejemplo n.º 5
0
        private static int CalcAnimClipHash(TrackAsset asset)
        {
            int num = 0;

            if (asset != null)
            {
                AnimationTrack animationTrack = asset as AnimationTrack;
                if (animationTrack != null)
                {
                    for (int num2 = 0; num2 != animationTrack.clips.Length; num2++)
                    {
                        num ^= ((ITimelineItem)animationTrack.clips[num2]).Hash();
                    }
                }
                for (int num3 = 0; num3 != asset.subTracks.Count; num3++)
                {
                    num ^= KeyTraverser.CalcAnimClipHash(asset.subTracks[num3]);
                }
            }
            return(num);
        }
Ejemplo n.º 6
0
        public static IEnumerable <float> GetTrackKeyTimes(AnimationTrack track)
        {
            IEnumerable <float> result;

            if (track != null)
            {
                if (track.inClipMode)
                {
                    result = (from c in track.clips
                              where c.recordable
                              select c).SelectMany((TimelineClip x) => KeyTraverser.GetClipKeyTimes(x));
                    return(result);
                }
                if (track.animClip != null && !track.animClip.get_empty())
                {
                    result = AnimationClipCurveCache.Instance.GetCurveInfo(track.animClip).keyTimes;
                    return(result);
                }
            }
            result = new float[0];
            return(result);
        }
Ejemplo n.º 7
0
 private void RebuildKeyCache()
 {
     this.m_KeyCache = (from x in (from x in this.m_Asset.flattenedTracks
                                   where x as AnimationTrack != null
                                   select x).Cast <AnimationTrack>().SelectMany((AnimationTrack t) => KeyTraverser.GetTrackKeyTimes(t))
                        orderby x
                        select x).ToArray <float>();
     if (this.m_KeyCache.Length > 0)
     {
         float[] array = new float[this.m_KeyCache.Length];
         array[0] = this.m_KeyCache[0];
         int num = 0;
         for (int i = 1; i < this.m_KeyCache.Length; i++)
         {
             if (this.m_KeyCache[i] - array[num] > this.m_Epsilon)
             {
                 num++;
                 array[num] = this.m_KeyCache[i];
             }
         }
         this.m_KeyCache = array;
         Array.Resize <float>(ref this.m_KeyCache, num + 1);
     }
 }