From 3db00dbaff3f59a575afaff99a3f2a1f88c38276 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Wed, 25 Oct 2023 13:35:16 +0200 Subject: [PATCH] Improved index output types of iterator nodes --- .../image/batch_processing/load_images.py | 5 ++++- .../image/batch_processing/split_spritesheet.py | 2 +- .../chaiNNer_standard/image/video_frames/load_video.py | 7 ++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backend/src/packages/chaiNNer_standard/image/batch_processing/load_images.py b/backend/src/packages/chaiNNer_standard/image/batch_processing/load_images.py index 7a688f9e0..65434e28b 100644 --- a/backend/src/packages/chaiNNer_standard/image/batch_processing/load_images.py +++ b/backend/src/packages/chaiNNer_standard/image/batch_processing/load_images.py @@ -77,7 +77,10 @@ def list_glob(directory: str, globexpr: str, ext_filter: List[str]) -> List[str] DirectoryOutput("Directory", output_type="Input0"), TextOutput("Subdirectory Path"), TextOutput("Name"), - NumberOutput("Index"), + NumberOutput( + "Index", + output_type="if Input4 { min(uint, Input5 - 1) } else { uint }", + ), ], iterator_outputs=IteratorOutputInfo(outputs=[0, 2, 3, 4]), node_type="newIterator", diff --git a/backend/src/packages/chaiNNer_standard/image/batch_processing/split_spritesheet.py b/backend/src/packages/chaiNNer_standard/image/batch_processing/split_spritesheet.py index 5c41b9e27..73fd08154 100644 --- a/backend/src/packages/chaiNNer_standard/image/batch_processing/split_spritesheet.py +++ b/backend/src/packages/chaiNNer_standard/image/batch_processing/split_spritesheet.py @@ -48,7 +48,7 @@ channels: Input0.channels, }""" ), - NumberOutput("Index", output_type="uint").with_docs( + NumberOutput("Index", output_type="min(uint, Input1 * Input2 - 1)").with_docs( "A counter that starts at 0 and increments by 1 for each image." ), ], diff --git a/backend/src/packages/chaiNNer_standard/image/video_frames/load_video.py b/backend/src/packages/chaiNNer_standard/image/video_frames/load_video.py index afbfd98f3..0803a2149 100644 --- a/backend/src/packages/chaiNNer_standard/image/video_frames/load_video.py +++ b/backend/src/packages/chaiNNer_standard/image/video_frames/load_video.py @@ -46,9 +46,10 @@ ], outputs=[ ImageOutput("Frame Image", channels=3), - NumberOutput("Frame Index", output_type="uint").with_docs( - "A counter that starts at 0 and increments by 1 for each frame." - ), + NumberOutput( + "Frame Index", + output_type="if Input1 { min(uint, Input2 - 1) } else { uint }", + ).with_docs("A counter that starts at 0 and increments by 1 for each frame."), DirectoryOutput("Video Directory", of_input=0), FileNameOutput("Name", of_input=0), NumberOutput("FPS"),