TrackItemsDrawer.cs 1000 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using UnityEngine;
  4. namespace UnityEditor.Timeline
  5. {
  6. struct TrackItemsDrawer
  7. {
  8. List<ItemsLayer> m_Layers;
  9. ClipsLayer m_ClipsLayer;
  10. public IEnumerable<TimelineClipGUI> clips
  11. {
  12. get { return m_ClipsLayer.items.Cast<TimelineClipGUI>(); }
  13. }
  14. public TrackItemsDrawer(IRowGUI parent)
  15. {
  16. m_Layers = null;
  17. m_ClipsLayer = null;
  18. BuildGUICache(parent);
  19. }
  20. void BuildGUICache(IRowGUI parent)
  21. {
  22. m_ClipsLayer = new ClipsLayer(Layer.Clips, parent);
  23. m_Layers = new List<ItemsLayer>
  24. {
  25. m_ClipsLayer,
  26. new MarkersLayer(Layer.Markers, parent)
  27. };
  28. }
  29. public void Draw(Rect rect, WindowState state)
  30. {
  31. foreach (var layer in m_Layers)
  32. {
  33. layer.Draw(rect, state);
  34. }
  35. }
  36. }
  37. }