Skip to content

Commit

Permalink
[cuebot] fix dispatched frame chunk end frame number (#1467)
Browse files Browse the repository at this point in the history
**Link the Issue(s) this Pull Request is related to.**
#1129 

**Summarize your change.**
Fix the frame end resolution of a frame chunk used to fill the place
holder `#FRAME_END#`.
The current behavior incorrectly returns the index of the last frame in
the frame list instead of its value.

Leverage `FrameSet.get_chunk` method that is already doing all the
legwork to get the last frame.


**Related topics**
- #1320
- #367

---------

Signed-off-by: Anton Brand <[email protected]>
Co-authored-by: Kern Attila GERMAIN <[email protected]>
  • Loading branch information
anton-ubi and KernAttila authored Aug 29, 2024
1 parent e4f62d3 commit 1e4695d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,9 @@ public RunFrame prepareRqdRunFrame(VirtualProc proc, DispatchFrame frame) {
FrameSet fs = new FrameSet(frame.range);
int startFrameIndex = fs.index(frameNumber);
String frameSpec = fs.getChunk(startFrameIndex, frame.chunkSize);
int lastFrameIndex = fs.size() - 1;
int endChunkIndex = startFrameIndex + frame.chunkSize - 1;
if (endChunkIndex > lastFrameIndex) {
endChunkIndex = lastFrameIndex;
}

FrameSet chunkFrameSet = new FrameSet(frameSpec);
int chunkEndFrame = chunkFrameSet.get(chunkFrameSet.size()-1);

RunFrame.Builder builder = RunFrame.newBuilder()
.setShot(frame.shot)
Expand Down Expand Up @@ -424,7 +421,7 @@ public RunFrame prepareRqdRunFrame(VirtualProc proc, DispatchFrame frame) {
.replaceAll("#ZFRAME#", zFrameNumber)
.replaceAll("#IFRAME#", String.valueOf(frameNumber))
.replaceAll("#FRAME_START#", String.valueOf(frameNumber))
.replaceAll("#FRAME_END#", String.valueOf(endChunkIndex))
.replaceAll("#FRAME_END#", String.valueOf(chunkEndFrame))
.replaceAll("#FRAME_CHUNK#", String.valueOf(frame.chunkSize))
.replaceAll("#LAYER#", frame.layerName)
.replaceAll("#JOB#", frame.jobName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,20 @@ public void shouldStopBeforeTheEndOfTheRange() {

assertEquals("55-60", result.getChunk(0, 10));
}

@Test
public void shouldReturnLastFrame() {
FrameSet result1 = new FrameSet("1-10x2");

FrameSet chunk1 = new FrameSet(result1.getChunk(0, 3));
FrameSet chunk2 = new FrameSet(result1.getChunk(3, 3));

assertEquals(5, chunk1.get(chunk1.size()-1));
assertEquals(9, chunk2.get(chunk2.size()-1));

FrameSet result2 = new FrameSet("1");
FrameSet chunk3 = new FrameSet(result2.getChunk(0, 3));

assertEquals(1, chunk3.get(chunk3.size()-1));
}
}

0 comments on commit 1e4695d

Please sign in to comment.