TimelineMode.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using UnityEngine;
  3. namespace UnityEditor.Timeline
  4. {
  5. enum TimelineModeGUIState
  6. {
  7. Disabled,
  8. Hidden,
  9. Enabled
  10. }
  11. abstract class TimelineMode
  12. {
  13. public struct HeaderState
  14. {
  15. public TimelineModeGUIState breadCrumb;
  16. public TimelineModeGUIState sequenceSelector;
  17. public TimelineModeGUIState options;
  18. }
  19. public struct TrackOptionsState
  20. {
  21. public TimelineModeGUIState newButton;
  22. public TimelineModeGUIState editAsAssetButton;
  23. }
  24. public HeaderState headerState { get; protected set; }
  25. public TrackOptionsState trackOptionsState { get; protected set; }
  26. public TimelineModes mode { get; protected set; }
  27. public abstract bool ShouldShowPlayRange(WindowState state);
  28. public abstract bool ShouldShowTimeCursor(WindowState state);
  29. public virtual bool ShouldShowTrackBindings(WindowState state)
  30. {
  31. return ShouldShowTimeCursor(state);
  32. }
  33. public virtual bool ShouldShowTimeArea(WindowState state)
  34. {
  35. return !state.IsEditingAnEmptyTimeline();
  36. }
  37. public abstract TimelineModeGUIState TrackState(WindowState state);
  38. public abstract TimelineModeGUIState ToolbarState(WindowState state);
  39. public virtual TimelineModeGUIState PreviewState(WindowState state)
  40. {
  41. return Application.isPlaying ? TimelineModeGUIState.Disabled : TimelineModeGUIState.Enabled;
  42. }
  43. public virtual TimelineModeGUIState EditModeButtonsState(WindowState state)
  44. {
  45. return TimelineModeGUIState.Enabled;
  46. }
  47. }
  48. [Flags]
  49. internal enum TimelineModes
  50. {
  51. None = 0,
  52. Active = 1,
  53. ReadOnly = 2,
  54. Inactive = 4,
  55. Disabled = 8,
  56. AssetEdition = 16,
  57. All = Active | ReadOnly | Inactive | Disabled,
  58. Default = Active | AssetEdition
  59. }
  60. }