FIX: support raft filament choice not correct after changing filament color

Jira: STUDIO-14092
Change-Id: Ida78c86dc7bb607d4cfdb4a6c4a6644ff9c7eb69
(cherry picked from commit 7c0c20ab20f1b1c0816a98227ffaf1bc1d9ff1ce)
This commit is contained in:
weiting.ji
2025-08-19 20:47:51 +08:00
committed by Noisyfox
parent 811060aabb
commit 17d463c841

View File

@@ -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);
}