A game about forced loneliness, made by TACStudios
at master 34 lines 1.1 kB view raw
1using System; 2using UnityEngine; 3 4namespace UnityEditor.Timeline 5{ 6 static class AnimationClipExtensions 7 { 8 public static UInt64 ClipVersion(this AnimationClip clip) 9 { 10 if (clip == null) 11 return 0; 12 13 var info = AnimationClipCurveCache.Instance.GetCurveInfo(clip); 14 var version = (UInt32)info.version; 15 var count = (UInt32)info.curves.Length; 16 var result = (UInt64)version; 17 result |= ((UInt64)count) << 32; 18 return result; 19 } 20 21 public static CurveChangeType GetChangeType(this AnimationClip clip, ref UInt64 curveVersion) 22 { 23 var version = clip.ClipVersion(); 24 var changeType = CurveChangeType.None; 25 if ((curveVersion >> 32) != (version >> 32)) 26 changeType = CurveChangeType.CurveAddedOrRemoved; 27 else if (curveVersion != version) 28 changeType = CurveChangeType.CurveModified; 29 30 curveVersion = version; 31 return changeType; 32 } 33 } 34}