FIX: Support raft interface lost when filament removed

Jira: STUDIO-13777
Change-Id: I500bfb558e6739a79c679afad10e8be121a49ec2
(cherry picked from commit c9cf0843d2ecb3d2c549e2282a922b8fa4ae9ddc)
This commit is contained in:
weiting.ji
2025-08-04 16:32:36 +08:00
committed by Noisyfox
parent 0a9dd678c5
commit 54d74b02af
2 changed files with 16 additions and 4 deletions

View File

@@ -752,14 +752,21 @@ struct DynamicFilamentList : DynamicList
if (items.empty())
update(true);
auto cb = dynamic_cast<ComboBox *>(c->window);
auto n = cb->GetSelection();
wxString old_selection = cb->GetStringSelection();
int old_index = cb->GetSelection();
cb->Clear();
cb->Append(_L("Default"));
for (auto i : items) {
cb->Append(i.first, i.second ? *i.second : wxNullBitmap);
}
if ((unsigned int)n < cb->GetCount())
cb->SetSelection(n);
int new_index = cb->FindString(old_selection);
if (new_index != wxNOT_FOUND) {
cb->SetSelection(new_index);
} else if ((unsigned int) old_index < cb->GetCount()) {
cb->SetSelection(old_index);
} else {
cb->SetSelection(0);
}
}
wxString get_value(int index) override
{