mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 19:35:55 +08:00
Fix for SPE-2039 : Wrong preset selection, when loading configuration from 3mf.
Bug description: If all new presets are actualized from current update but some of them isn't installed (doesn't selected in ConfigWizard), and user try to load 3mf with those non-installed presets, than first visible preset is selected instead of temporary installed preset. + Update dirty state for edited preset only it's needed.
This commit is contained in:
parent
ff8a351a1b
commit
f69b1a2247
@ -814,8 +814,8 @@ std::pair<Preset*, bool> PresetCollection::load_external_preset(
|
||||
it = this->find_preset_renamed(original_name);
|
||||
found = it != m_presets.end();
|
||||
}
|
||||
if (found && profile_print_params_same(it->config, cfg)) {
|
||||
// The preset exists and it matches the values stored inside config.
|
||||
if (found && profile_print_params_same(it->config, cfg) && it->is_visible) {
|
||||
// The preset exists and is visible and it matches the values stored inside config.
|
||||
if (select == LoadAndSelect::Always)
|
||||
this->select_preset(it - m_presets.begin());
|
||||
return std::make_pair(&(*it), false);
|
||||
@ -838,10 +838,13 @@ std::pair<Preset*, bool> PresetCollection::load_external_preset(
|
||||
// Select the existing preset and override it with new values, so that
|
||||
// the differences will be shown in the preset editor against the referenced profile.
|
||||
this->select_preset(it - m_presets.begin());
|
||||
|
||||
// update dirty state only if it's needed
|
||||
if (!profile_print_params_same(it->config, cfg)) {
|
||||
// The source config may contain keys from many possible preset types. Just copy those that relate to this preset.
|
||||
|
||||
// Following keys are not used neither by the UI nor by the slicing core, therefore they are not important
|
||||
// Erase them from config appl to avoid redundant "dirty" parameter in loaded preset.
|
||||
// Erase them from config apply to avoid redundant "dirty" parameter in loaded preset.
|
||||
for (const char* key : { "print_settings_id", "filament_settings_id", "sla_print_settings_id", "sla_material_settings_id", "printer_settings_id",
|
||||
"printer_model", "printer_variant", "default_print_profile", "default_filament_profile", "default_sla_print_profile", "default_sla_material_profile" })
|
||||
keys.erase(std::remove(keys.begin(), keys.end(), key), keys.end());
|
||||
@ -851,6 +854,7 @@ std::pair<Preset*, bool> PresetCollection::load_external_preset(
|
||||
// Don't save the newly loaded project as a "saved into project" state.
|
||||
//update_saved_preset_from_current_preset();
|
||||
assert(this->get_edited_preset().is_dirty);
|
||||
}
|
||||
return std::make_pair(&(*it), this->get_edited_preset().is_dirty);
|
||||
}
|
||||
if (inherits.empty()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user