mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 12:19:03 +08:00
Tab: Fixed update of extruders_filaments after filament renaming
Fix for #13554 - Renaming a filament preset with parentheses causes incompatible profiles to appear (SPE-2556)
This commit is contained in:
parent
525c04bebe
commit
fae52557cc
@ -4404,6 +4404,13 @@ void Tab::rename_preset()
|
|||||||
|
|
||||||
assert(old_name == edited_preset.name);
|
assert(old_name == edited_preset.name);
|
||||||
|
|
||||||
|
if (m_type == Preset::TYPE_FILAMENT) {
|
||||||
|
// Filaments will be sorted inside collection after remaning,
|
||||||
|
// so, cache preset names for each extruder to reset them after renaming
|
||||||
|
m_preset_bundle->cache_extruder_filaments_names();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool was_renamed = true;
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
try {
|
try {
|
||||||
// rename selected and edited presets
|
// rename selected and edited presets
|
||||||
@ -4426,10 +4433,18 @@ void Tab::rename_preset()
|
|||||||
catch (const exception& ex) {
|
catch (const exception& ex) {
|
||||||
const std::string exception = diagnostic_information(ex);
|
const std::string exception = diagnostic_information(ex);
|
||||||
printf("Can't rename a preset : %s", exception.c_str());
|
printf("Can't rename a preset : %s", exception.c_str());
|
||||||
|
was_renamed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort presets after renaming
|
// sort presets after renaming
|
||||||
std::sort(m_presets->begin(), m_presets->end());
|
std::sort(m_presets->begin(), m_presets->end());
|
||||||
|
|
||||||
|
if (was_renamed && m_type == Preset::TYPE_FILAMENT) {
|
||||||
|
// Reset extruder_filaments only if preset was renamed
|
||||||
|
m_preset_bundle->reset_extruder_filaments();
|
||||||
|
// and update compatibility for extruders after reset
|
||||||
|
m_preset_bundle->update_filaments_compatible(PresetSelectCompatibleType::OnlyIfWasCompatible);
|
||||||
|
}
|
||||||
// update selection
|
// update selection
|
||||||
select_preset_by_name(new_name, true);
|
select_preset_by_name(new_name, true);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user