Fix of a wrong order of processing the config sources when slicing

from command line. Fixes
PrusaSlicer Console --load my_config.ini doesnt overwrites the 3mf profiles or not used. #3893

The priority of config values is now:

1) Config keys from command line, for example --fill-pattern=stars
   (highest priority, overwrites everything below)
2) Config files loaded with --load
3) Config from 3mf
   (lowest priority)
This commit is contained in:
bubnikv 2020-03-24 11:52:43 +01:00
parent ad5ae50933
commit 015a4a37dc

View File

@ -132,14 +132,18 @@ int CLI::run(int argc, char **argv)
Model model;
try {
// When loading an AMF or 3MF, config is imported as well, including the printer technology.
model = Model::read_from_file(file, &m_print_config, true);
PrinterTechnology other_printer_technology = get_printer_technology(m_print_config);
DynamicPrintConfig config;
model = Model::read_from_file(file, &config, true);
PrinterTechnology other_printer_technology = get_printer_technology(config);
if (printer_technology == ptUnknown) {
printer_technology = other_printer_technology;
} else if (printer_technology != other_printer_technology && other_printer_technology != ptUnknown) {
boost::nowide::cerr << "Mixing configurations for FFF and SLA technologies" << std::endl;
return 1;
}
// config is applied to m_print_config before the current m_config values.
config += std::move(m_print_config);
m_print_config = std::move(config);
} catch (std::exception &e) {
boost::nowide::cerr << file << ": " << e.what() << std::endl;
return 1;