@@ -49,7 +49,10 @@ function getPrunedEndedPieceInstances(info: SelectedPartInstanceTimelineInfo) {
4949 return info . pieceInstances . filter ( ( p ) => ! hasPieceInstanceDefinitelyEnded ( p , info . partTimes . nowInPart ) )
5050 }
5151}
52- function removeInfiniteContinuations ( info : PartInstanceAndPieceInstances ) : PartInstanceAndPieceInstances {
52+ function removeInfiniteContinuations (
53+ info : PartInstanceAndPieceInstances ,
54+ isCurrentPart : boolean
55+ ) : PartInstanceAndPieceInstances {
5356 const partId = info . part . part . _id
5457 return {
5558 ...info ,
@@ -58,11 +61,9 @@ function removeInfiniteContinuations(info: PartInstanceAndPieceInstances): PartI
5861 // Always include non infinite pieces
5962 if ( ! inst . infinite ) return true
6063
61- // Include rundown owned pieces until they start playback
64+ // Only include rundown owned pieces in the current part
6265 if ( ! inst . piece . startPartId ) {
63- // TODO
64- // nocommit
65- return true
66+ return isCurrentPart
6667 }
6768
6869 // Include infinite pieces in the part where they start
@@ -105,35 +106,44 @@ export async function getLookeaheadObjects(
105106
106107 const partInstancesInfo : PartInstanceAndPieceInstances [ ] = _ . compact ( [
107108 partInstancesInfo0 . current
108- ? removeInfiniteContinuations ( {
109- part : partInstancesInfo0 . current . partInstance ,
110- onTimeline : true ,
111- nowInPart : partInstancesInfo0 . current . partTimes . nowInPart ,
112- allPieces : getPrunedEndedPieceInstances ( partInstancesInfo0 . current ) ,
113- calculatedTimings : partInstancesInfo0 . current . calculatedTimings ,
114- } )
109+ ? removeInfiniteContinuations (
110+ {
111+ part : partInstancesInfo0 . current . partInstance ,
112+ onTimeline : true ,
113+ nowInPart : partInstancesInfo0 . current . partTimes . nowInPart ,
114+ allPieces : getPrunedEndedPieceInstances ( partInstancesInfo0 . current ) ,
115+ calculatedTimings : partInstancesInfo0 . current . calculatedTimings ,
116+ } ,
117+ true
118+ )
115119 : undefined ,
116120 partInstancesInfo0 . next
117- ? removeInfiniteContinuations ( {
118- part : partInstancesInfo0 . next . partInstance ,
119- onTimeline : ! ! partInstancesInfo0 . current ?. partInstance ?. part ?. autoNext , //TODO -QL
120- nowInPart : partInstancesInfo0 . next . partTimes . nowInPart ,
121- allPieces : partInstancesInfo0 . next . pieceInstances ,
122- calculatedTimings : partInstancesInfo0 . next . calculatedTimings ,
123- } )
121+ ? removeInfiniteContinuations (
122+ {
123+ part : partInstancesInfo0 . next . partInstance ,
124+ onTimeline : ! ! partInstancesInfo0 . current ?. partInstance ?. part ?. autoNext , //TODO -QL
125+ nowInPart : partInstancesInfo0 . next . partTimes . nowInPart ,
126+ allPieces : partInstancesInfo0 . next . pieceInstances ,
127+ calculatedTimings : partInstancesInfo0 . next . calculatedTimings ,
128+ } ,
129+ false
130+ )
124131 : undefined ,
125132 ] )
126133
127134 // Track the previous info for checking how the timeline will be built
128135 let previousPartInfo : PartInstanceAndPieceInstances | undefined
129136 if ( partInstancesInfo0 . previous ) {
130- previousPartInfo = removeInfiniteContinuations ( {
131- part : partInstancesInfo0 . previous . partInstance ,
132- onTimeline : true ,
133- nowInPart : partInstancesInfo0 . previous . partTimes . nowInPart ,
134- allPieces : getPrunedEndedPieceInstances ( partInstancesInfo0 . previous ) ,
135- calculatedTimings : partInstancesInfo0 . previous . calculatedTimings ,
136- } )
137+ previousPartInfo = removeInfiniteContinuations (
138+ {
139+ part : partInstancesInfo0 . previous . partInstance ,
140+ onTimeline : true ,
141+ nowInPart : partInstancesInfo0 . previous . partTimes . nowInPart ,
142+ allPieces : getPrunedEndedPieceInstances ( partInstancesInfo0 . previous ) ,
143+ calculatedTimings : partInstancesInfo0 . previous . calculatedTimings ,
144+ } ,
145+ false
146+ )
137147 }
138148
139149 // TODO: Do we need to use processAndPrunePieceInstanceTimings on these pieces? In theory yes, but that gets messy and expensive.
0 commit comments