SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB

4 years ago
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using UnityEngine;
  4. using UnityEngine.Timeline;
  5. namespace UnityEditor.Timeline
  6. {
  7. class TimelineClipGroup
  8. {
  9. readonly TimelineClip[] m_Clips;
  10. readonly TimelineClip m_LeftMostClip;
  11. readonly TimelineClip m_RightMostClip;
  12. public TimelineClip[] clips
  13. {
  14. get { return m_Clips; }
  15. }
  16. public double start
  17. {
  18. get { return m_LeftMostClip.start; }
  19. set
  20. {
  21. var offset = value - m_LeftMostClip.start;
  22. foreach (var clip in m_Clips)
  23. clip.start += offset;
  24. }
  25. }
  26. public double end
  27. {
  28. get { return m_RightMostClip.end; }
  29. }
  30. public TimelineClipGroup(IEnumerable<TimelineClip> clips)
  31. {
  32. Debug.Assert(clips != null && clips.Any());
  33. m_Clips = clips.ToArray();
  34. m_LeftMostClip = null;
  35. m_RightMostClip = null;
  36. foreach (var clip in m_Clips)
  37. {
  38. if (m_LeftMostClip == null || clip.start < m_LeftMostClip.start)
  39. m_LeftMostClip = clip;
  40. if (m_RightMostClip == null || clip.end > m_RightMostClip.end)
  41. m_RightMostClip = clip;
  42. }
  43. }
  44. }
  45. }