mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-05 04:54:08 -06:00
Brim separation from object, follow up to 82373334bc
1) Changed the name of the variable "brim_offset" to "brim_separation" for clarity. 2) Added legacy conversion after loading an old 3MF that does not define then new "brim_separation" variable: The "brim_separation" is being filled in with the "elefant_foot_compensation" value to produce equal brim separation to the old PrusaSlicer that saved that 3MF file.
This commit is contained in:
parent
4cc729b312
commit
5f26bfd397
12 changed files with 46 additions and 31 deletions
|
@ -420,6 +420,7 @@ namespace Slic3r {
|
|||
~_3MF_Importer();
|
||||
|
||||
bool load_model_from_file(const std::string& filename, Model& model, DynamicPrintConfig& config, ConfigSubstitutionContext& config_substitutions, bool check_version);
|
||||
unsigned int version() const { return m_version; }
|
||||
|
||||
private:
|
||||
void _destroy_xml_parser();
|
||||
|
@ -2990,6 +2991,19 @@ bool _3MF_Exporter::_add_custom_gcode_per_print_z_file_to_archive( mz_zip_archiv
|
|||
return true;
|
||||
}
|
||||
|
||||
// Perform conversions based on the config values available.
|
||||
//FIXME provide a version of PrusaSlicer that stored the project file (3MF).
|
||||
static void handle_legacy_project_loaded(unsigned int version_project_file, DynamicPrintConfig& config)
|
||||
{
|
||||
if (! config.has("brim_separation")) {
|
||||
if (auto *opt_elephant_foot = config.option<ConfigOptionFloat>("elefant_foot_compensation", false); opt_elephant_foot) {
|
||||
// Conversion from older PrusaSlicer which applied brim separation equal to elephant foot compensation.
|
||||
auto *opt_brim_separation = config.option<ConfigOptionFloat>("brim_separation", true);
|
||||
opt_brim_separation->value = opt_elephant_foot->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool load_3mf(const char* path, DynamicPrintConfig& config, ConfigSubstitutionContext& config_substitutions, Model* model, bool check_version)
|
||||
{
|
||||
if (path == nullptr || model == nullptr)
|
||||
|
@ -3000,6 +3014,7 @@ bool load_3mf(const char* path, DynamicPrintConfig& config, ConfigSubstitutionCo
|
|||
_3MF_Importer importer;
|
||||
bool res = importer.load_model_from_file(path, *model, config, config_substitutions, check_version);
|
||||
importer.log_errors();
|
||||
handle_legacy_project_loaded(importer.version(), config);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue