暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AnimationClipExtensions.cs 1.0KB

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