From 4eecb61722c053c7dad31ffa7b7316d783e844e6 Mon Sep 17 00:00:00 2001 From: Darby Johnston Date: Tue, 19 Sep 2023 10:08:12 -0700 Subject: [PATCH 1/3] Sequence fix --- lib/tlCore/Path.cpp | 15 +++++++++++++-- lib/tlCore/Path.h | 2 ++ lib/tlCore/PathInline.h | 9 --------- tests/tlCoreTest/PathTest.cpp | 4 ++++ tests/tltest/main.cpp | 3 +-- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/lib/tlCore/Path.cpp b/lib/tlCore/Path.cpp index 6ec6a530f..4f4ba4ca8 100644 --- a/lib/tlCore/Path.cpp +++ b/lib/tlCore/Path.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -51,8 +52,9 @@ namespace tl (j - i) <= options.maxNumberDigits) { _number = value.substr(i, j - i); - const int number = std::atoi(_number.c_str()); - _sequence = math::IntRange(number, number); + _numberValue = std::atoi(_number.c_str()); + _numberDigits = math::digits(_numberValue); + _sequence = math::IntRange(_numberValue, _numberValue); if (_number.size() > 1 && '0' == _number[0]) { _padding = _number.size(); @@ -137,6 +139,15 @@ namespace tl _sequence = value; } + bool Path::sequence(const Path& value) const + { + return + _directory == value._directory && + _baseName == value._baseName && + (_padding == value._padding || _padding == value._numberDigits) && + _extension == value._extension; + } + std::string Path::getSequenceString() const { std::string out; diff --git a/lib/tlCore/Path.h b/lib/tlCore/Path.h index c25075394..4cc309874 100644 --- a/lib/tlCore/Path.h +++ b/lib/tlCore/Path.h @@ -100,6 +100,8 @@ namespace tl std::string _directory; std::string _baseName; std::string _number; + int _numberValue = 0; + int _numberDigits = 0; math::IntRange _sequence; uint8_t _padding = 0; std::string _extension; diff --git a/lib/tlCore/PathInline.h b/lib/tlCore/PathInline.h index 2778f7bea..80c7cd348 100644 --- a/lib/tlCore/PathInline.h +++ b/lib/tlCore/PathInline.h @@ -53,15 +53,6 @@ namespace tl return _sequence.getMin() != _sequence.getMax(); } - inline bool Path::sequence(const Path& value) const - { - return - _directory == value._directory && - _baseName == value._baseName && - _padding == value._padding && - _extension == value._extension; - } - inline const std::string& Path::getExtension() const { return _extension; diff --git a/tests/tlCoreTest/PathTest.cpp b/tests/tlCoreTest/PathTest.cpp index 8d9f3fb8f..5e1f5e244 100644 --- a/tests/tlCoreTest/PathTest.cpp +++ b/tests/tlCoreTest/PathTest.cpp @@ -117,6 +117,10 @@ namespace tl TLRENDER_ASSERT(!p.sequence(Path("render.101.exr"))); TLRENDER_ASSERT("0001-0100" == p.getSequenceString()); } + { + Path path("render.00000.exr"); + TLRENDER_ASSERT(path.sequence(Path("render.10000.exr"))); + } { TLRENDER_ASSERT(Path("/").isAbsolute()); TLRENDER_ASSERT(Path("/tmp").isAbsolute()); diff --git a/tests/tltest/main.cpp b/tests/tltest/main.cpp index 16c4fa20a..b75d8d3aa 100644 --- a/tests/tltest/main.cpp +++ b/tests/tltest/main.cpp @@ -113,8 +113,7 @@ int main(int argc, char* argv[]) std::vector > tests; if (0) { - tests.push_back(app_tests::AppTest::create(context)); - tests.push_back(app_tests::CmdLineTest::create(context)); + tests.push_back(core_tests::PathTest::create(context)); } else { From 49e73019ada42b1d888cdf93aaf734a259437031 Mon Sep 17 00:00:00 2001 From: Darby Johnston Date: Tue, 19 Sep 2023 10:08:37 -0700 Subject: [PATCH 2/3] Wipe compare fix --- lib/tlGL/OffscreenBuffer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tlGL/OffscreenBuffer.cpp b/lib/tlGL/OffscreenBuffer.cpp index f608c2602..b61e63035 100644 --- a/lib/tlGL/OffscreenBuffer.cpp +++ b/lib/tlGL/OffscreenBuffer.cpp @@ -281,7 +281,9 @@ namespace tl { glFramebufferRenderbuffer( GL_FRAMEBUFFER, - GL_DEPTH_ATTACHMENT, + p.options.stencil != OffscreenStencil::None ? + GL_DEPTH_STENCIL_ATTACHMENT : + GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, p.depthStencilID); } From 413439b470e337be5451db0ab3b91dd498fea3a3 Mon Sep 17 00:00:00 2001 From: Darby Johnston Date: Tue, 19 Sep 2023 10:14:47 -0700 Subject: [PATCH 3/3] Sequence fix --- lib/tlCore/FileInfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tlCore/FileInfo.cpp b/lib/tlCore/FileInfo.cpp index 2b7328115..cec66b6ea 100644 --- a/lib/tlCore/FileInfo.cpp +++ b/lib/tlCore/FileInfo.cpp @@ -103,7 +103,9 @@ namespace tl const Path p(path, fileName); const FileInfo f(p); bool sequence = false; - if (options.sequence && !p.getNumber().empty()) + if (options.sequence && + !p.getNumber().empty() && + f.getType() != Type::Directory) { for (auto& i : out) {