|
@@ -227,6 +227,7 @@ export function pickFilamentForSlot(
|
|
|
let bestCompatible: { ref: PresetRef; score: number } | null = null;
|
|
let bestCompatible: { ref: PresetRef; score: number } | null = null;
|
|
|
let bestMismatch: { ref: PresetRef; score: number } | null = null;
|
|
let bestMismatch: { ref: PresetRef; score: number } | null = null;
|
|
|
let bestWrongType: { ref: PresetRef; score: number } | null = null;
|
|
let bestWrongType: { ref: PresetRef; score: number } | null = null;
|
|
|
|
|
+ let bestWrongTypeMismatch: { ref: PresetRef; score: number } | null = null;
|
|
|
for (const tier of SLICE_MODAL_TIER_ORDER) {
|
|
for (const tier of SLICE_MODAL_TIER_ORDER) {
|
|
|
for (const p of by[tier].filament) {
|
|
for (const p of by[tier].filament) {
|
|
|
let score = 0;
|
|
let score = 0;
|
|
@@ -240,7 +241,14 @@ export function pickFilamentForSlot(
|
|
|
score += TIER_BONUS[tier];
|
|
score += TIER_BONUS[tier];
|
|
|
const ref = { source: p.source, id: p.id };
|
|
const ref = { source: p.source, id: p.id };
|
|
|
if (statesDifferentMaterial(p, reqType)) {
|
|
if (statesDifferentMaterial(p, reqType)) {
|
|
|
- if (bestWrongType == null || score > bestWrongType.score) {
|
|
|
|
|
|
|
+ // Still split by printer: with no preset of the plate's material at
|
|
|
|
|
+ // all, a wrong-printer pick is refused by the slicer outright, so it
|
|
|
|
|
+ // must not beat one the selected printer can take.
|
|
|
|
|
+ if (presetCompatibility(p, 'filament', printerName, compatIndex) === 'mismatch') {
|
|
|
|
|
+ if (bestWrongTypeMismatch == null || score > bestWrongTypeMismatch.score) {
|
|
|
|
|
+ bestWrongTypeMismatch = { ref, score };
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (bestWrongType == null || score > bestWrongType.score) {
|
|
|
bestWrongType = { ref, score };
|
|
bestWrongType = { ref, score };
|
|
|
}
|
|
}
|
|
|
} else if (presetCompatibility(p, 'filament', printerName, compatIndex) === 'mismatch') {
|
|
} else if (presetCompatibility(p, 'filament', printerName, compatIndex) === 'mismatch') {
|
|
@@ -258,6 +266,7 @@ export function pickFilamentForSlot(
|
|
|
// user can see and change in the dropdown than a null the modal renders as
|
|
// user can see and change in the dropdown than a null the modal renders as
|
|
|
// an empty slot, which is what shipped before the partition existed.
|
|
// an empty slot, which is what shipped before the partition existed.
|
|
|
if (bestWrongType != null) return bestWrongType.ref;
|
|
if (bestWrongType != null) return bestWrongType.ref;
|
|
|
|
|
+ if (bestWrongTypeMismatch != null) return bestWrongTypeMismatch.ref;
|
|
|
// Final fallback when there are no filament presets at all (empty
|
|
// Final fallback when there are no filament presets at all (empty
|
|
|
// registry) — pickDefault returns null in that case too, but keeping the
|
|
// registry) — pickDefault returns null in that case too, but keeping the
|
|
|
// call mirrors the rest of the picker logic for shape consistency.
|
|
// call mirrors the rest of the picker logic for shape consistency.
|