AnimationTrackKeyDataSource.cs 714 B

12345678910111213141516171819202122232425
  1. using UnityEngine;
  2. using UnityEngine.Timeline;
  3. // Data sources for key overlays
  4. namespace UnityEditor.Timeline
  5. {
  6. // Used for key overlays manipulators
  7. class AnimationTrackKeyDataSource : BasePropertyKeyDataSource
  8. {
  9. readonly float m_TrackOffset;
  10. protected override AnimationClip animationClip { get; }
  11. public AnimationTrackKeyDataSource(AnimationTrack track)
  12. {
  13. animationClip = track != null ? track.infiniteClip : null;
  14. m_TrackOffset = track != null ? (float)track.infiniteClipTimeOffset : 0.0f;
  15. }
  16. protected override float TransformKeyTime(float keyTime)
  17. {
  18. return keyTime + m_TrackOffset;
  19. }
  20. }
  21. }