From b0df9d0500d6bbd1879dacbb387d9c8857e9b212 Mon Sep 17 00:00:00 2001 From: Vikas Kendre Date: Mon, 20 Apr 2026 18:17:54 +0530 Subject: [PATCH] fix(sequence): correctly detect padding for frames with no leading zeros pad_size() returned 0 when the integer's natural string representation matched the frame string length (e.g. "1000" -> to_string(1000) == "1000"). This produced {:00d} URIs for sequences like shot.1000.exr, causing all frames to fail loading after the first. The padding width is always the length of the frame string regardless of whether leading zeros are present, so simply return frame.size(). Fixes #152 --- src/utility/src/sequence.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utility/src/sequence.cpp b/src/utility/src/sequence.cpp index 22b0a26c6..8ee71327a 100644 --- a/src/utility/src/sequence.cpp +++ b/src/utility/src/sequence.cpp @@ -344,9 +344,11 @@ std::vector default_collapse_sequences(const std::vector &entri } int pad_size(const std::string &frame) { - // -01 == pad 3 - // 0 pad means unknown padding - return (std::to_string(std::atoi(frame.c_str())).size() == frame.size() ? 0 : frame.size()); + // The padding width is always the length of the frame string. + // e.g. "0001" -> 4, "1000" -> 4, "-01" -> 3, "" -> 0 (unknown) + // Previously, frames with no leading zeros (e.g. "1000") incorrectly + // returned 0, producing {:00d} URIs that failed to load any frame. + return static_cast(frame.size()); } std::string pad_spec(const int pad) {