Fixed loading of configs and configs from g-codes.
This commit is contained in:
parent
b11d9708ed
commit
e6ecb77d9a
2 changed files with 4 additions and 4 deletions
|
@ -115,7 +115,7 @@ DynamicPrintConfig& Preset::load(const std::vector<std::string> &keys)
|
||||||
if (! this->is_default) {
|
if (! this->is_default) {
|
||||||
// Load the preset file, apply preset values on top of defaults.
|
// Load the preset file, apply preset values on top of defaults.
|
||||||
try {
|
try {
|
||||||
this->config.load(this->file);
|
this->config.load_from_ini(this->file);
|
||||||
Preset::normalize(this->config);
|
Preset::normalize(this->config);
|
||||||
} catch (const std::ifstream::failure&) {
|
} catch (const std::ifstream::failure&) {
|
||||||
throw std::runtime_error(std::string("The selected preset does not exist anymore: ") + this->file);
|
throw std::runtime_error(std::string("The selected preset does not exist anymore: ") + this->file);
|
||||||
|
@ -264,7 +264,7 @@ void PresetCollection::load_presets(const std::string &dir_path, const std::stri
|
||||||
Preset& PresetCollection::load_preset(const std::string &path, const std::string &name, const DynamicPrintConfig &config, bool select)
|
Preset& PresetCollection::load_preset(const std::string &path, const std::string &name, const DynamicPrintConfig &config, bool select)
|
||||||
{
|
{
|
||||||
DynamicPrintConfig cfg(this->default_preset().config);
|
DynamicPrintConfig cfg(this->default_preset().config);
|
||||||
cfg.apply(config, true);
|
cfg.apply_only(config, cfg.keys(), true);
|
||||||
return this->load_preset(path, name, std::move(cfg));
|
return this->load_preset(path, name, std::move(cfg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ void PresetBundle::load_config_file_config(const std::string &path, const Dynami
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Load the configs into this->filaments and make them active.
|
// Load the configs into this->filaments and make them active.
|
||||||
filament_presets.clear();
|
this->filament_presets.clear();
|
||||||
for (size_t i = 0; i < configs.size(); ++ i) {
|
for (size_t i = 0; i < configs.size(); ++ i) {
|
||||||
char suffix[64];
|
char suffix[64];
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
@ -304,7 +304,7 @@ void PresetBundle::load_config_file_config(const std::string &path, const Dynami
|
||||||
sprintf(suffix, " (%d)", i);
|
sprintf(suffix, " (%d)", i);
|
||||||
// Load all filament presets, but only select the first one in the preset dialog.
|
// Load all filament presets, but only select the first one in the preset dialog.
|
||||||
this->filaments.load_preset(path, name + suffix, std::move(configs[i]), i == 0).is_external = true;
|
this->filaments.load_preset(path, name + suffix, std::move(configs[i]), i == 0).is_external = true;
|
||||||
filament_presets.emplace_back(name + suffix);
|
this->filament_presets.emplace_back(name + suffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue