Fixed an error when importing / exporting Config Bundles with
at least one SLA print or SLA material defined.
This commit is contained in:
parent
1905d49ade
commit
bcab373a54
@ -1156,6 +1156,18 @@ std::string PresetCollection::name() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string PresetCollection::section_name() const
|
||||
{
|
||||
switch (this->type()) {
|
||||
case Preset::TYPE_PRINT: return "print";
|
||||
case Preset::TYPE_FILAMENT: return "filament";
|
||||
case Preset::TYPE_SLA_PRINT: return "sla_print";
|
||||
case Preset::TYPE_SLA_MATERIAL: return "sla_material";
|
||||
case Preset::TYPE_PRINTER: return "printer";
|
||||
default: return "invalid";
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> PresetCollection::system_preset_names() const
|
||||
{
|
||||
size_t num = 0;
|
||||
|
@ -230,7 +230,10 @@ public:
|
||||
void reset(bool delete_files);
|
||||
|
||||
Preset::Type type() const { return m_type; }
|
||||
// Name, to be used on the screen and in error messages. Not localized.
|
||||
std::string name() const;
|
||||
// Name, to be used as a section name in config bundle, and as a folder name for presets.
|
||||
std::string section_name() const;
|
||||
const std::deque<Preset>& operator()() const { return m_presets; }
|
||||
|
||||
// Add default preset at the start of the collection, increment the m_default_preset counter.
|
||||
|
@ -1208,7 +1208,7 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
|
||||
#else
|
||||
// Store the print/filament/printer presets at the same location as the upstream Slic3r.
|
||||
#endif
|
||||
/ presets->name() / file_name).make_preferred();
|
||||
/ presets->section_name() / file_name).make_preferred();
|
||||
// Load the preset into the list of presets, save it to disk.
|
||||
Preset &loaded = presets->load_preset(file_path.string(), preset_name, std::move(config), false);
|
||||
if (flags & LOAD_CFGBNDLE_SAVE)
|
||||
@ -1365,7 +1365,7 @@ void PresetBundle::export_configbundle(const std::string &path, bool export_syst
|
||||
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.
|
||||
continue;
|
||||
c << std::endl << "[" << presets->name() << ":" << preset.name << "]" << std::endl;
|
||||
c << std::endl << "[" << presets->section_name() << ":" << preset.name << "]" << std::endl;
|
||||
for (const std::string &opt_key : preset.config.keys())
|
||||
c << opt_key << " = " << preset.config.serialize(opt_key) << std::endl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user