default_material

This commit is contained in:
sunsets
2023-09-26 13:38:41 +08:00
parent 40e1a5534e
commit 07b20e3c40
2 changed files with 29 additions and 10 deletions

View File

@@ -1215,15 +1215,27 @@ Preset* PresetCollection::find_preset(const std::string &name, bool first_visibl
}
// Return index of the first visible preset. Certainly at least the '- default -' preset shall be visible.
//B40
size_t PresetCollection::first_visible_idx() const
{
size_t idx = m_default_suppressed ? m_num_default_presets : 0;
for (; idx < m_presets.size(); ++ idx)
if (m_presets[idx].is_visible)
break;
if (idx == m_presets.size())
idx = 0;
return idx;
size_t first_visible = -1;
size_t idx = m_default_suppressed ? m_num_default_presets : 0;
for (; idx < m_presets.size(); ++idx)
if (m_presets[idx].is_visible) {
if (first_visible == -1)
first_visible = idx;
if (m_type != Preset::TYPE_FILAMENT)
break;
else {
if (m_presets[idx].name.find("PLA") != std::string::npos) {
first_visible = idx;
break;
}
}
}
if (first_visible == -1)
first_visible = 0;
return first_visible;
}
void PresetCollection::set_default_suppressed(bool default_suppressed)