mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-05 06:41:10 +00:00
Load a CLI Project's Printer and Process Settings as the GUI Does
The CLI filled only the keys a project lacked from its system preset. The GUI builds a project preset differently: the project's values go over the default preset, without the print-host keys, and every key the project does not list in different_settings_to_system is refreshed to its base system preset's current value. After a profile update the two sliced the same project differently. That step now lives in Preset::load_external_config, which takes plain configs and gets the base preset from a callback, so the collection lookup stays in PresetCollection. PresetBundle::project_different_keys builds the kept-key set from a project's escaped entry, adding the preset bookkeeping keys, and is used by both the GUI and the CLI. PresetCollection::load_external_preset calls the shared step with no change in behaviour. The CLI now builds the project's printer and process configs with the same step, passing the system preset from resolve_system_preset. That drops the hand-kept skip list for print-host and variant-layout keys and the legacy-key check: the shared step already excludes print-host keys and maps per-variant values onto the base preset's variant layout. The --uptodate path and a printer or process given on the command line are left as they were. Because the GUI's kept-key set always holds the bookkeeping keys, the refresh runs for every project that names a system preset, so the CLI now loads that preset's vendor on every such run.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# End-to-end check that the CLI fills settings missing from a project from the project's system presets.
|
||||
# End-to-end check that the CLI loads a project's printer and process settings as the GUI does.
|
||||
#
|
||||
# A project saved before an option existed has no value for it. The GUI takes such keys from the
|
||||
# project's system printer and process presets, not from the option defaults, and the CLI must slice
|
||||
# the project with the same values. A project is exported from the shipped Bambu Lab P1S presets, one
|
||||
# printer key and one process key are removed from it, one kept key is changed, and it is sliced again.
|
||||
# The GUI takes every key a project does not list as changed from the project's current system preset:
|
||||
# keys saved before an option existed, and keys holding an older system value. Keys the project lists
|
||||
# in different_settings_to_system keep the project's value. A project is exported from the shipped
|
||||
# Bambu Lab P1S presets; one printer key and one process key are removed, one printer key and one
|
||||
# process key are changed without being listed, one key is changed and listed, and it is sliced again.
|
||||
#
|
||||
# usage: test_cli_project_missing_keys.sh <orca-slicer binary> <python3> <resources/profiles/BBL>
|
||||
set -u
|
||||
@@ -46,7 +47,8 @@ slice base "$WORK/cube.stl" \
|
||||
--load-settings "$PROFILES/machine/Bambu Lab P1S 0.4 nozzle.json;$PROFILES/process/0.20mm Standard @BBL X1C.json" \
|
||||
--load-filaments "$PROFILES/filament/Bambu PLA Basic @BBL P1S 0.4 nozzle.json"
|
||||
|
||||
# The removed keys, with their option defaults from PrintConfig.cpp, and a kept key with a new value.
|
||||
# The removed keys, with their option defaults from PrintConfig.cpp; stale keys changed without being
|
||||
# listed as different, which must come back with the system value; and a listed key the project keeps.
|
||||
"$PY" - "$WORK/base/out.3mf" "$WORK/old.3mf" <<'EOF' || exit $?
|
||||
import json, sys, zipfile
|
||||
|
||||
@@ -62,8 +64,13 @@ with zipfile.ZipFile(src) as zin, zipfile.ZipFile(dst, "w", zipfile.ZIP_DEFLATED
|
||||
print("SKIP: %s is %s in the system preset, the option default, so the test cannot tell them apart" % (key, default))
|
||||
sys.exit(77)
|
||||
expected = {key: config.pop(key) for key in missing}
|
||||
for key in ("top_shell_layers", "extruder_clearance_height_to_rod"):
|
||||
expected[key] = config[key]
|
||||
config[key] = str(int(float(config[key])) + 1)
|
||||
expected["wall_loops"] = str(int(config["wall_loops"]) + 1)
|
||||
config["wall_loops"] = expected["wall_loops"]
|
||||
different = config["different_settings_to_system"]
|
||||
different[0] = ";".join([k for k in different[0].split(";") if k] + ["wall_loops"])
|
||||
data = json.dumps(config, indent=4)
|
||||
zout.writestr(item, data)
|
||||
with open(dst + ".expected.json", "w") as f:
|
||||
|
||||
Reference in New Issue
Block a user