Follow-up 31e4a20f6d
: some code refactoring
This commit is contained in:
parent
1d145bb359
commit
f9e46ea871
1 changed files with 4 additions and 10 deletions
|
@ -603,16 +603,10 @@ void Tab::update_changed_ui()
|
||||||
if (m_type == Preset::TYPE_PRINTER) {
|
if (m_type == Preset::TYPE_PRINTER) {
|
||||||
{
|
{
|
||||||
auto check_bed_custom_options = [](std::vector<std::string>& keys) {
|
auto check_bed_custom_options = [](std::vector<std::string>& keys) {
|
||||||
bool was_deleted = false;
|
size_t old_keys_size = keys.size();
|
||||||
for (std::vector<std::string>::iterator it = keys.begin(); it != keys.end(); ) {
|
keys.erase(std::remove_if(keys.begin(), keys.end(), [](const std::string& key) {
|
||||||
if (*it == "bed_custom_texture" || *it == "bed_custom_model") {
|
return key == "bed_custom_texture" || key == "bed_custom_model"; }), keys.end());
|
||||||
it = keys.erase(it);
|
if (old_keys_size != keys.size() && std::find(keys.begin(), keys.end(), "bed_shape") == keys.end())
|
||||||
was_deleted = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
if (was_deleted && std::find(keys.begin(), keys.end(), "bed_shape") == keys.end())
|
|
||||||
keys.emplace_back("bed_shape");
|
keys.emplace_back("bed_shape");
|
||||||
};
|
};
|
||||||
check_bed_custom_options(dirty_options);
|
check_bed_custom_options(dirty_options);
|
||||||
|
|
Loading…
Reference in a new issue