filtering out common generic filaments with matching generic counterparts from vendor bundle

This commit is contained in:
David Kocik 2022-02-01 10:27:45 +01:00
parent e33c80a681
commit a1dc88551b
2 changed files with 20 additions and 1 deletions

View File

@ -1096,6 +1096,7 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil
if (opt) if (opt)
config.set_key_value("num_extruders", new ConfigOptionInt((int)static_cast<const ConfigOptionFloats*>(opt)->values.size())); config.set_key_value("num_extruders", new ConfigOptionInt((int)static_cast<const ConfigOptionFloats*>(opt)->values.size()));
bool some_compatible = false; bool some_compatible = false;
std::vector<size_t> indexes_of_common_presets;
for (size_t idx_preset = m_num_default_presets; idx_preset < m_presets.size(); ++ idx_preset) { for (size_t idx_preset = m_num_default_presets; idx_preset < m_presets.size(); ++ idx_preset) {
bool selected = idx_preset == m_idx_selected; bool selected = idx_preset == m_idx_selected;
Preset &preset_selected = m_presets[idx_preset]; Preset &preset_selected = m_presets[idx_preset];
@ -1112,7 +1113,25 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil
m_idx_selected = size_t(-1); m_idx_selected = size_t(-1);
if (selected) if (selected)
preset_selected.is_compatible = preset_edited.is_compatible; preset_selected.is_compatible = preset_edited.is_compatible;
if (preset_edited.vendor->common_profile) {
indexes_of_common_presets.push_back(idx_preset);
}
} }
// filter out common generic profiles where profile with same alias and compability exists
if (!indexes_of_common_presets.empty()) {
for (size_t idx_preset = m_num_default_presets; idx_preset < m_presets.size(); ++idx_preset) {
if (!m_presets[idx_preset].vendor->common_profile && m_presets[idx_preset].is_compatible) {
std::string preset_alias = m_presets[idx_preset].alias;
for (size_t idx_idx = 0; idx_idx < indexes_of_common_presets.size(); ++idx_idx) {
size_t idx_common = indexes_of_common_presets[idx_idx];
if (m_presets[idx_common].alias == preset_alias) {
m_presets[idx_common].is_compatible = false;
}
}
}
}
}
// Update visibility of the default profiles here if the defaults are suppressed, the current profile is not compatible and we don't want to select another compatible profile. // Update visibility of the default profiles here if the defaults are suppressed, the current profile is not compatible and we don't want to select another compatible profile.
if (m_idx_selected >= m_num_default_presets && m_default_suppressed) if (m_idx_selected >= m_num_default_presets && m_default_suppressed)
for (size_t i = 0; i < m_num_default_presets; ++ i) for (size_t i = 0; i < m_num_default_presets; ++ i)

View File

@ -2177,7 +2177,7 @@ void ConfigWizard::priv::update_materials(Technology technology)
} }
} }
// common filament bundle has no printers - filament would be never added // common filament bundle has no printers - filament would be never added
if(pair.second.preset_bundle->printers.begin() == pair.second.preset_bundle->printers.end()) if(pair.second.vendor_profile->common_profile && pair.second.preset_bundle->printers.begin() == pair.second.preset_bundle->printers.end())
{ {
if (!filaments.containts(&filament)) { if (!filaments.containts(&filament)) {
filaments.push(&filament); filaments.push(&filament);