Fixed SPE-1192

Wrong list of SLA-materials, when no SLA-printer is installed, but 3MF with SLA print is loaded
This commit is contained in:
YuSanka 2022-02-07 10:00:49 +01:00
parent 6667852d92
commit 874da0281d
2 changed files with 8 additions and 5 deletions

View File

@ -412,6 +412,8 @@ void Preset::set_visible_from_appconfig(const AppConfig &app_config)
for (auto it = this->renamed_from.begin(); ! is_visible && it != this->renamed_from.end(); ++ it)
is_visible = has(*it);
}
else
is_visible = false;
}
}

View File

@ -2409,16 +2409,17 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
try {
if (type_3mf || type_zip_amf) {
DynamicPrintConfig config;
PrinterTechnology loaded_printer_technology;
{
DynamicPrintConfig config_loaded;
ConfigSubstitutionContext config_substitutions{ ForwardCompatibilitySubstitutionRule::Enable };
model = Slic3r::Model::read_from_archive(path.string(), &config_loaded, &config_substitutions, only_if(load_config, Model::LoadAttribute::CheckVersion));
if (load_config && !config_loaded.empty()) {
// Based on the printer technology field found in the loaded config, select the base for the config,
PrinterTechnology printer_technology = Preset::printer_technology(config_loaded);
loaded_printer_technology = Preset::printer_technology(config_loaded);
// We can't to load SLA project if there is at least one multi-part object on the bed
if (printer_technology == ptSLA) {
if (loaded_printer_technology == ptSLA) {
const ModelObjectPtrs& objects = q->model().objects;
for (auto object : objects)
if (object->volumes.size() > 1) {
@ -2430,7 +2431,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
}
}
config.apply(printer_technology == ptFFF ?
config.apply(loaded_printer_technology == ptFFF ?
static_cast<const ConfigBase&>(FullPrintConfig::defaults()) :
static_cast<const ConfigBase&>(SLAFullPrintConfig::defaults()));
// and place the loaded config over the base.
@ -2461,7 +2462,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
};
std::vector<std::string> names;
if (printer_technology == ptFFF) {
if (loaded_printer_technology == ptFFF) {
update_selected_preset_visibility(preset_bundle->prints, names);
for (const std::string& filament : preset_bundle->filament_presets) {
Preset* preset = preset_bundle->filaments.find_preset(filament);
@ -2492,7 +2493,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
}
}
if (printer_technology == ptFFF)
if (loaded_printer_technology == ptFFF)
CustomGCode::update_custom_gcode_per_print_z_from_config(model.custom_gcode_per_print_z, &preset_bundle->project_config);
// For exporting from the amf/3mf we shouldn't check printer_presets for the containing information about "Print Host upload"