mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-09 11:07:34 +00:00
CrealityPrintAgent: prefer system bases over user copies in CFS matcher
The matcher tiebreaker previously preferred user-edited filament presets over system bases on a tied score. For a K2 owner who has a custom copy of Creality Generic PLA @K2-all called eg Creality Hyper PLA @K2 (mine), the matcher scored both that copy and the shipped brand-specific Hyper PLA @Creality K2 0.4 nozzle at 30, then tiebreak picked the user copy. User copies inherit filament_id from their parent -- in this case the generic PLA GFL99 -- so the returned id pointed at Generic PLA, not at Hyper PLA brand-specific id (01001). PresetBundle::sync_ams_list then resolved by id back to Creality Generic PLA @K2-all, visibly losing the brand on every sync. Flip the tiebreaker to prefer system over user. The shipped brand-specific preset always wins now and sync_ams_list lands on the right slot label. Drop the post-sync user-override step from the sidebar path that was layered on to compensate -- silently substituting the user local tuning is the wrong default for an upstream-shipped feature; users who want their local tuning on a synced slot still get to it via the existing combo dropdown.
This commit is contained in:
@@ -32,11 +32,14 @@ bool has_visible_base_preset(const PresetCollection& filaments, const std::strin
|
||||
// Score visible compatible filament presets against the CFS spool metadata and
|
||||
// return the best-matching filament_id. Scoring:
|
||||
// +20 preset name contains brand_name as a substring
|
||||
// (e.g. "Hyper PLA" in "Creality Hyper PLA @K2 (Harky)")
|
||||
// (e.g. "Hyper PLA" in "Hyper PLA @Creality K2 0.4 nozzle")
|
||||
// +10 preset name contains the vendor substring (e.g. "Creality")
|
||||
// Tiebreak: prefer user-edited presets over system presets — the K2 owner
|
||||
// typically copies the system base and tweaks PA / temps for their box,
|
||||
// so their copy is the better fit than the pristine system entry.
|
||||
// Tiebreak: prefer the SYSTEM (shipped) preset over user copies. Brand-
|
||||
// specific system presets carry their own filament_id; user copies of
|
||||
// generic presets inherit a generic filament_id from their parent, so
|
||||
// preferring the user copy can collapse a brand-specific match back to
|
||||
// "Generic PLA" via the inherited id. Plus: this code targets upstream
|
||||
// OrcaSlicer where shipping the user's local tuning would be wrong.
|
||||
// Requires the preset's declared filament_type to equal the spool's base type
|
||||
// (PLA/PETG/ABS/...) so we never auto-pick a PETG preset for a PLA spool.
|
||||
// Falls back to filaments.filament_id_by_type(base_type) when nothing scores.
|
||||
@@ -101,7 +104,7 @@ std::string CrealityPrintAgent::match_filament_preset(const PresetCollection& fi
|
||||
std::sort(matches.begin(), matches.end(),
|
||||
[](const Match& a, const Match& b) {
|
||||
if (a.score != b.score) return a.score > b.score;
|
||||
if (a.is_user != b.is_user) return a.is_user;
|
||||
if (a.is_user != b.is_user) return !a.is_user; // prefer system over user
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user