[Feature] An option to export non manufacturer printer/filament/print profiles. #1292

https://github.com/prusa3d/Slic3r/issues/1292
This commit is contained in:
bubnikv 2018-12-12 18:37:10 +01:00
parent 598e6f648b
commit 80d0ca3ec0
2 changed files with 9 additions and 8 deletions

View File

@ -1313,7 +1313,7 @@ void PresetBundle::update_compatible(bool select_other_if_incompatible)
} }
} }
void PresetBundle::export_configbundle(const std::string &path) //, const DynamicPrintConfig &settings void PresetBundle::export_configbundle(const std::string &path, bool export_system_settings)
{ {
boost::nowide::ofstream c; boost::nowide::ofstream c;
c.open(path, std::ios::out | std::ios::trunc); c.open(path, std::ios::out | std::ios::trunc);
@ -1323,14 +1323,15 @@ void PresetBundle::export_configbundle(const std::string &path) //, const Dynami
// Export the print, filament and printer profiles. // Export the print, filament and printer profiles.
// #ys_FIXME_SLA_PRINT for (const PresetCollection *presets : {
for (size_t i_group = 0; i_group < 3; ++ i_group) { (const PresetCollection*)&this->prints, (const PresetCollection*)&this->filaments,
const PresetCollection &presets = (i_group == 0) ? this->prints : (i_group == 1) ? this->filaments : this->printers; (const PresetCollection*)&this->sla_prints, (const PresetCollection*)&this->sla_materials,
for (const Preset &preset : presets()) { (const PresetCollection*)&this->printers }) {
if (preset.is_default || preset.is_external) for (const Preset &preset : (*presets)()) {
if (preset.is_default || preset.is_external || (preset.is_system && ! export_system_settings))
// Only export the common presets, not external files or the default preset. // Only export the common presets, not external files or the default preset.
continue; continue;
c << std::endl << "[" << presets.name() << ":" << preset.name << "]" << std::endl; c << std::endl << "[" << presets->name() << ":" << preset.name << "]" << std::endl;
for (const std::string &opt_key : preset.config.keys()) for (const std::string &opt_key : preset.config.keys())
c << opt_key << " = " << preset.config.serialize(opt_key) << std::endl; c << opt_key << " = " << preset.config.serialize(opt_key) << std::endl;
} }

View File

@ -102,7 +102,7 @@ public:
size_t load_configbundle(const std::string &path, unsigned int flags = LOAD_CFGBNDLE_SAVE); size_t load_configbundle(const std::string &path, unsigned int flags = LOAD_CFGBNDLE_SAVE);
// Export a config bundle file containing all the presets and the names of the active presets. // Export a config bundle file containing all the presets and the names of the active presets.
void export_configbundle(const std::string &path); // , const DynamicPrintConfig &settings); void export_configbundle(const std::string &path, bool export_system_settings = false);
// Update a filament selection combo box on the platter for an idx_extruder. // Update a filament selection combo box on the platter for an idx_extruder.
void update_platter_filament_ui(unsigned int idx_extruder, GUI::PresetComboBox *ui); void update_platter_filament_ui(unsigned int idx_extruder, GUI::PresetComboBox *ui);