Added a project specific config to the PresetBundle class.

This project specific config will be stored into the config.ini,
into .3mf and .amf and .gcode,
and recover it from the same files.
This commit is contained in:
bubnikv 2018-03-14 11:54:11 +01:00
parent 0781dd8271
commit 5f28b89ae0
3 changed files with 16 additions and 0 deletions

View file

@ -32,6 +32,9 @@
namespace Slic3r {
static std::vector<std::string> s_project_options {
};
PresetBundle::PresetBundle() :
prints(Preset::TYPE_PRINT, Preset::print_options()),
filaments(Preset::TYPE_FILAMENT, Preset::filament_options()),
@ -56,6 +59,8 @@ PresetBundle::PresetBundle() :
this->filaments.load_bitmap_default("spool.png");
this->printers .load_bitmap_default("printer_empty.png");
this->load_compatible_bitmaps();
this->project_config.apply_only(FullPrintConfig::defaults(), s_project_options);
}
PresetBundle::~PresetBundle()
@ -223,6 +228,7 @@ DynamicPrintConfig PresetBundle::full_config() const
out.apply(FullPrintConfig());
out.apply(this->prints.get_edited_preset().config);
out.apply(this->printers.get_edited_preset().config);
out.apply(this->project_config);
auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(out.option("nozzle_diameter"));
size_t num_extruders = nozzle_diameter->values.size();
@ -412,6 +418,9 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
}
}
// 4) Load the project config values (the per extruder wipe matrix etc).
this->project_config.apply_only(config, s_project_options);
this->update_compatible_with_printer(false);
}