fix(moonraker): User-Presets ohne filament_id per Namen matchen
Presets die via 'Save As' angelegt werden haben keine filament_id. Statt sie zu überspringen werden sie per Namen gematcht und ihr Preset-Name als Identifier zurückgegeben.
This commit is contained in:
@@ -191,14 +191,12 @@ std::string filament_id_by_name(const Slic3r::PresetCollection& filaments,
|
||||
for (int pass = 1; pass <= 2; ++pass) {
|
||||
for (size_t i = 0; i < filaments.size(); ++i) {
|
||||
const auto& preset = filaments.preset(i);
|
||||
if (!preset.is_visible || preset.filament_id.empty()) {
|
||||
if (pass == 1) {
|
||||
BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: filament matcher skip preset='" << preset.name
|
||||
<< "' visible=" << preset.is_visible
|
||||
<< " filament_id_empty=" << preset.filament_id.empty();
|
||||
}
|
||||
if (!preset.is_visible) {
|
||||
continue;
|
||||
}
|
||||
// User presets (created via "Save As") may have no filament_id yet.
|
||||
// We still match them by name and use their name as the identifier.
|
||||
const std::string preset_id = preset.filament_id.empty() ? preset.name : preset.filament_id;
|
||||
if (pass == 1 && !preset.is_compatible) {
|
||||
continue; // Pass 1: only compatible presets
|
||||
}
|
||||
@@ -221,12 +219,12 @@ std::string filament_id_by_name(const Slic3r::PresetCollection& filaments,
|
||||
}
|
||||
const std::string candidate = normalize_filament_name_for_match(preset.name);
|
||||
BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: filament matcher compare (pass=" << pass << ") preset='" << preset.name
|
||||
<< "' normalized='" << candidate << "' filament_id='" << preset.filament_id << "'";
|
||||
<< "' normalized='" << candidate << "' preset_id='" << preset_id << "'";
|
||||
if (filament_name_match_relaxed(wanted, candidate)) {
|
||||
BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: filament matcher matched (pass=" << pass << ") requested='" << filament_name
|
||||
<< "' normalized='" << wanted << "' to preset='" << preset.name
|
||||
<< "' filament_id='" << preset.filament_id << "'";
|
||||
return preset.filament_id;
|
||||
<< "' preset_id='" << preset_id << "'";
|
||||
return preset_id;
|
||||
}
|
||||
}
|
||||
if (pass == 1) {
|
||||
|
||||
Reference in New Issue
Block a user