mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 11:12:35 +02:00
MakerWorld 3MFs sliced for P2S (and likely other Bambu printers) ship project_settings.config entries with "-1" on fields BambuStudio writes to mean "inherit from the parent process preset". The headless slicer CLI's StaticPrintConfig validator runs against the embedded settings *before* --load-settings overrides apply, so the sentinel trips the field's lower-bound check and the CLI exits non-zero before the supplied profile triplet is consulted. Both slice paths (with-profiles and the embedded-settings fallback) read the same config and fail the same way, so the user surfaces the error. Surgical fix: open Metadata/project_settings.config, remove allowlisted keys when their value is exactly "-1", re-zip. Allowlist starts with the two from this report (raft_first_layer_expansion, tree_support_wall_count) plus prime_tower_brim_width (a known sentinel cited in earlier reports). Non-allowlisted "-1" values are left alone so a blanket strip can't corrupt legitimate negative values. Other zip entries pass through byte-identical — no risk of the failure mode the previous full-strip experiment hit (silent CLI exit on initialisation). Sanitiser runs before both slice_with_profiles and slice_without_profiles paths since both fail on the same sentinel. 13 new unit tests in test_project_settings_sentinel_sanitiser.py cover the allowlist removal contract (parametrised across all sentinel keys), preservation of unaffected values, byte-identical round-trip of unrelated zip entries, and defensive fallbacks for non-zip / malformed / no-config inputs. Adding new sentinel keys is one-line: append to _PROJECT_SETTINGS_SENTINEL_KEYS in library.py.