From ef0748e96bdc2826aa60602e4e4a577e6e6b910d Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Mon, 29 Sep 2025 23:34:26 +0800 Subject: [PATCH] Ignore the index when accessing a scalar variable --- src/libslic3r/PlaceholderParser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/PlaceholderParser.cpp b/src/libslic3r/PlaceholderParser.cpp index b83ecbac0e..92e4210f3c 100644 --- a/src/libslic3r/PlaceholderParser.cpp +++ b/src/libslic3r/PlaceholderParser.cpp @@ -1011,10 +1011,10 @@ namespace client OptWithPos &output) { if (! ctx->skipping()) { - if (! opt.opt->is_vector()) - ctx->throw_exception("Cannot index a scalar variable", opt.it_range); if (index < 0) index = 0; // Orca: fallback to first element if index < 0, this matches the behavior of BambuStudio + if (!opt.opt->is_vector()) + index = -1; // Orca: ignore the index if variable is scalar, this matches the behavior of BambuStudio output = opt; output.index = index; } else