11using System . Collections . Generic ;
2+ using Unity . FilmInternalUtilities ;
23using UnityEngine ;
34using UnityEngine . Assertions ;
45using UnityEngine . Playables ;
@@ -35,7 +36,8 @@ public override void ProcessFrame(Playable playable, FrameData info, object play
3536 return ;
3637 }
3738
38- GetActiveTimelineClipInto ( m_clips , m_playableDirector . time , out TimelineClip clip , out T activePlayableAsset ) ;
39+ TimelineUtility . GetActiveTimelineClipInto ( m_clips , m_playableDirector . time , out TimelineClip clip ,
40+ out T activePlayableAsset ) ;
3941 if ( null == clip )
4042 return ;
4143
@@ -47,59 +49,6 @@ public override void ProcessFrame(Playable playable, FrameData info, object play
4749
4850 #endregion IPlayableBehaviour interfaces
4951
50-
51- //----------------------------------------------------------------------------------------------------------------------
52-
53- internal static void GetActiveTimelineClipInto ( IList < TimelineClip > sortedClips , double directorTime ,
54- out TimelineClip outClip , out T outAsset ) {
55-
56- TimelineClip prevClipWithPostExtrapolation = null ;
57- TimelineClip nextClipWithPreExtrapolation = null ;
58- bool nextClipChecked = false ;
59-
60- foreach ( TimelineClip clip in sortedClips ) {
61-
62-
63- if ( directorTime < clip . start ) {
64- //must check only once since we loop from the start
65- if ( ! nextClipChecked ) {
66- //store next direct clip which has PreExtrapolation
67- nextClipWithPreExtrapolation = clip . hasPreExtrapolation ? clip : null ;
68- nextClipChecked = true ;
69- }
70-
71- continue ;
72- }
73-
74- if ( clip . end < directorTime ) {
75- //store prev direct clip which has PostExtrapolation
76- prevClipWithPostExtrapolation = clip . hasPostExtrapolation ? clip : null ;
77- continue ;
78- }
79-
80- outClip = clip ;
81- outAsset = clip . asset as T ;
82- return ;
83- }
84-
85-
86- //check for post-extrapolation
87- if ( null != prevClipWithPostExtrapolation ) {
88- outClip = prevClipWithPostExtrapolation ;
89- outAsset = prevClipWithPostExtrapolation . asset as T ;
90- return ;
91- }
92-
93- //check pre-extrapolation for the first clip
94- if ( null != nextClipWithPreExtrapolation ) {
95- outClip = nextClipWithPreExtrapolation ;
96- outAsset = nextClipWithPreExtrapolation . asset as T ;
97- return ;
98- }
99- outClip = null ;
100- outAsset = null ;
101- }
102-
10352//----------------------------------------------------------------------------------------------------------------------
10453
10554 internal void Init ( GameObject go , PlayableDirector director , IEnumerable < TimelineClip > clips ) {
0 commit comments