From 17d463c8417868f72447cb54391e9a5abe23c13a Mon Sep 17 00:00:00 2001 From: "weiting.ji" Date: Tue, 19 Aug 2025 20:47:51 +0800 Subject: [PATCH] FIX: support raft filament choice not correct after changing filament color Jira: STUDIO-14092 Change-Id: Ida78c86dc7bb607d4cfdb4a6c4a6644ff9c7eb69 (cherry picked from commit 7c0c20ab20f1b1c0816a98227ffaf1bc1d9ff1ce) --- src/slic3r/GUI/Plater.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 0063d37618..c01e193652 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -761,11 +761,17 @@ struct DynamicFilamentList : DynamicList for (auto i : items) { cb->Append(i.first, i.second ? *i.second : wxNullBitmap); } - int new_index = cb->FindString(old_selection); - if (new_index != wxNOT_FOUND) { - cb->SetSelection(new_index); - } else if ((unsigned int) old_index < cb->GetCount()) { + + if (old_index >= 0 && (unsigned int) old_index < cb->GetCount()) { cb->SetSelection(old_index); + return; + } + + int new_index = cb->FindString(old_selection); + if (old_index == cb->GetCount()) { + cb->SetSelection(old_index - 1); + } else if (new_index != wxNOT_FOUND) { + cb->SetSelection(new_index); } else { cb->SetSelection(0); }