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

ISequenceState.cs 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine.Playables;
  4. using UnityEngine.Timeline;
  5. namespace UnityEditor.Timeline
  6. {
  7. interface ISequenceState : IDisposable
  8. {
  9. TimelineAsset asset { get; }
  10. PlayableDirector director { get; }
  11. TimelineClip hostClip { get; }
  12. List<UnityEngine.Object> cachedChildAssets { get; }
  13. double start { get; }
  14. double timeScale { get; }
  15. double duration { get; }
  16. bool isReadOnly { get; }
  17. bool isAssetOnly { get; set; }
  18. TimelineAssetViewModel viewModel { get; }
  19. double time { get; set; }
  20. int frame { get; set; }
  21. double frameRate { get; set; }
  22. Range GetEvaluableRange();
  23. double ToGlobalTime(double t);
  24. double ToLocalTime(double t);
  25. void ResetIsReadOnly();
  26. void InvalidateChildAssetCache();
  27. }
  28. /**
  29. * This class is used to hold default values for an implementation of ISequenceState.
  30. * It could be removed in a phase 2, but it is currently used to limit the scope of
  31. * this refactoring: it allows client code to access sequence info without having to
  32. * worry about `currentSequence` being null.
  33. * In the future this should be removed and we should pass around the correct data
  34. * structure (i.e. SequenceState OR WindowState) based on the situation.
  35. */
  36. class NullSequenceState : ISequenceState
  37. {
  38. public TimelineAsset asset { get { return null; } }
  39. public PlayableDirector director { get { return null; } }
  40. public TimelineClip hostClip { get { return null; } }
  41. List<UnityEngine.Object> ISequenceState.cachedChildAssets { get { return null; } }
  42. public double start { get { return 0.0; } }
  43. public double timeScale { get { return 1.0; } }
  44. public double duration { get { return 0.0; } }
  45. public bool isReadOnly { get { return false; } }
  46. public bool isAssetOnly { get { return false; } set { } }
  47. TimelineAssetViewModel m_ViewModel;
  48. public TimelineAssetViewModel viewModel
  49. {
  50. get
  51. {
  52. if (m_ViewModel == null)
  53. m_ViewModel = TimelineWindowViewPrefs.CreateUnassociatedViewModel();
  54. return m_ViewModel;
  55. }
  56. }
  57. public double time
  58. {
  59. get { return 0.0; }
  60. set { /* NO-OP*/ }
  61. }
  62. public int frame
  63. {
  64. get { return 0; }
  65. set { /* NO-OP*/ }
  66. }
  67. public double frameRate
  68. {
  69. get { return TimelineAsset.EditorSettings.kDefaultFrameRate; }
  70. set { /* NO-OP*/ }
  71. }
  72. public Range GetEvaluableRange()
  73. {
  74. return new Range();
  75. }
  76. public double ToGlobalTime(double t)
  77. {
  78. return t;
  79. }
  80. public double ToLocalTime(double t)
  81. {
  82. return t;
  83. }
  84. public void ResetIsReadOnly()
  85. {
  86. // NO-OP
  87. }
  88. public void InvalidateChildAssetCache()
  89. {
  90. // NO-OP
  91. }
  92. public void Dispose()
  93. {
  94. // NO-OP
  95. }
  96. }
  97. }