Added code for next step of a preset's aliasing
This commit is contained in:
parent
1096c24fae
commit
6429c3bd89
@ -631,19 +631,9 @@ void PageMaterials::update_lists(int sel1, int sel2)
|
||||
// #ys_FIXME_alias
|
||||
// const int i = list_l3->append(p->name, p);
|
||||
|
||||
int i = 0;
|
||||
if (materials->technology == T_FFF) {
|
||||
if (!p->alias.empty())
|
||||
return;
|
||||
i = list_l3->append(p->name, &p->name);
|
||||
}
|
||||
else if (materials->technology == T_SLA) {
|
||||
if (list_l3->find(p->alias) != wxNOT_FOUND)
|
||||
return;
|
||||
i = list_l3->append(p->alias, &p->alias);
|
||||
}
|
||||
else
|
||||
return;
|
||||
const int i = list_l3->append(p->alias, &p->alias);
|
||||
|
||||
const bool checked = wizard_p()->appconfig_new.has(materials->appconfig_section(), p->name);
|
||||
list_l3->Check(i, checked);
|
||||
@ -1711,12 +1701,6 @@ void ConfigWizard::priv::update_presets_in_config(const std::string& section, co
|
||||
appconfig_new.erase(s, key);
|
||||
};
|
||||
|
||||
// Not all of the filament preset have aliases.
|
||||
// Thus, we should to delete preset with a same as an alias_key name
|
||||
// add or delete preset from config
|
||||
if (section == AppConfig::SECTION_FILAMENTS)
|
||||
update(section, alias_key);
|
||||
|
||||
// add or delete presets had a same alias
|
||||
auto it = aliases.find(alias_key);
|
||||
if (it != aliases.end())
|
||||
|
@ -1133,12 +1133,10 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
|
||||
preset_name = section.first.substr(9);
|
||||
|
||||
for (const auto& item : section.second)
|
||||
{
|
||||
if (boost::starts_with(item.first, "alias")) {
|
||||
alias_name = item.second.data();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (boost::starts_with(section.first, "sla_print:")) {
|
||||
presets = &this->sla_prints;
|
||||
loaded = &loaded_sla_prints;
|
||||
@ -1295,8 +1293,14 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
|
||||
loaded.is_system = true;
|
||||
loaded.vendor = vendor_profile;
|
||||
}
|
||||
if (!alias_name.empty())
|
||||
loaded.alias = alias_name;
|
||||
|
||||
// next step of an preset name aliasing
|
||||
int end_pos = preset_name.find_first_of("@");
|
||||
if (end_pos != std::string::npos)
|
||||
alias_name = preset_name.substr(0, end_pos - 1);
|
||||
|
||||
loaded.alias = alias_name.empty() ? preset_name : alias_name;
|
||||
|
||||
++ presets_loaded;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user