Make the generic filament the default fallback instead of using filaments sorted alphabetically by name. (#12124)

This commit is contained in:
SoftFever
2026-02-01 00:06:39 +08:00
committed by GitHub
parent 67ac5ea43f
commit 073edc4a1c
2 changed files with 36 additions and 5 deletions

View File

@@ -1388,7 +1388,7 @@ void PresetCollection::load_presets(
}
if (presets_loaded.size() > 0)
m_presets.insert(m_presets.end(), std::make_move_iterator(presets_loaded.begin()), std::make_move_iterator(presets_loaded.end()));
std::sort(m_presets.begin() + m_num_default_presets, m_presets.end());
sort_presets();
//BBS: add config related logs
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": loaded %1% presets from %2%, type %3%")%presets_loaded.size() %dir %Preset::get_type_string(m_type);
//this->select_preset(first_visible_idx());
@@ -1583,7 +1583,7 @@ void PresetCollection::load_project_embedded_presets(std::vector<Preset*>& proje
}
m_presets.insert(m_presets.end(), std::make_move_iterator(presets_loaded.begin()), std::make_move_iterator(presets_loaded.end()));
std::sort(m_presets.begin() + m_num_default_presets, m_presets.end());
sort_presets();
//don't select it here
//this->select_preset(first_visible_idx());
unlock();
@@ -1976,7 +1976,7 @@ void PresetCollection::update_after_user_presets_loaded()
lock();
std::string selected_name = get_selected_preset_name();
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", before sort, type %1%, selected_idx %2%, selected_name %3%") %m_type %m_idx_selected %selected_name;
std::sort(m_presets.begin() + m_num_default_presets, m_presets.end());
sort_presets();
this->select_preset_by_name(selected_name, false);
unlock();
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", after sort, type %1%, selected_idx %2%") %m_type %m_idx_selected;
@@ -3129,7 +3129,9 @@ std::vector<std::string> PresetCollection::merge_presets(PresetCollection &&othe
if (preset.is_default || preset.is_external)
continue;
Preset key(m_type, preset.name);
auto it = std::lower_bound(m_presets.begin() + m_num_default_presets, m_presets.end(), key);
auto it = (m_type == Preset::TYPE_FILAMENT)
? std::lower_bound(m_presets.begin() + m_num_default_presets, m_presets.end(), key, filament_preset_less)
: std::lower_bound(m_presets.begin() + m_num_default_presets, m_presets.end(), key);
if (it == m_presets.end() || it->name != preset.name) {
if (preset.vendor != nullptr) {
// Re-assign a pointer to the vendor structure in the new PresetBundle.