The import of system profiles was improved to not inherit

the "renamed_from" field as it is specific to a concrete profile.

Prusa Research system profile was annotated with "renamed_from"
to indicate that the PETG profiles were renamed from PET somewhere
after PrusaSlicer 2.2.1 release.
This commit is contained in:
bubnikv 2020-03-15 08:38:17 +01:00
parent 7f3ac39757
commit 2e1aef87a1
3 changed files with 20 additions and 2 deletions

View file

@ -1073,7 +1073,11 @@ static void flatten_configbundle_hierarchy(boost::property_tree::ptree &tree, co
// Iterate in a reverse order, so the last change will be placed first in merged.
for (auto it_inherits = prst->inherits.rbegin(); it_inherits != prst->inherits.rend(); ++ it_inherits)
for (auto it = (*it_inherits)->node->begin(); it != (*it_inherits)->node->end(); ++ it)
if (prst->node->find(it->first) == prst->node->not_found())
if (it->first == "renamed_from") {
// Don't inherit "renamed_from" flag, it does not make sense. The "renamed_from" flag only makes sense for a concrete preset.
if (boost::starts_with((*it_inherits)->name, "*"))
BOOST_LOG_TRIVIAL(error) << boost::format("Nonpublic intermediate preset %1% contains a \"renamed_from\" field, which is ignored") % (*it_inherits)->name;
} else if (prst->node->find(it->first) == prst->node->not_found())
prst->node->add_child(it->first, it->second);
}